Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock the SSH key during E2E #188

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading