Skip to content

Commit

Permalink
Merge pull request #188 from ArangoGutierrez/devel/nvgha/ssh
Browse files Browse the repository at this point in the history
Lock the SSH key during E2E
  • Loading branch information
ArangoGutierrez authored Oct 17, 2024
2 parents 6ae995e + f242678 commit 0ec47b3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SSH_KEY: ${{ secrets.AWS_SSH_KEY }}
run: ./hack/e2e_tests.sh aws

- name: Archive test logs
Expand Down
2 changes: 1 addition & 1 deletion tests/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var _ = Describe("AWS", func() {
})
})

Context("and calling provision to create the environment", func() {
Context("and calling provider to create the environment", func() {
AfterAll(func(ctx context.Context) {
// Delete the environment
// We delete using AfterAll so that the environment is deleted even if the test fails
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,19 @@ func getTestEnv() {
Expect(err).NotTo(HaveOccurred())
}

func lockSShk() {
// look for env var set KEY
envSshKey := os.Getenv("AWS_SSH_KEY")
Expect(envSshKey).NotTo(BeEmpty())

err := os.WriteFile("/github/workspace/.cache/key", []byte(envSshKey), 0600)
Expect(err).NotTo(HaveOccurred())
}

// BeforeSuite runs before the test suite
var _ = BeforeSuite(func() {
// Init
getTestEnv()
// Lock ssh key
lockSShk()
})
2 changes: 1 addition & 1 deletion tests/test_aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
provider: aws
auth:
keyName: cnt-ci
privateKey: /Users/eduardoa/.ssh/cnt-ci.pem
privateKey: /github/workspace/.cache/key
instance:
type: g4dn.xlarge
region: us-west-1
Expand Down

0 comments on commit 0ec47b3

Please sign in to comment.