Skip to content

Commit

Permalink
add dynamic ssh to local stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
okankoAMZ committed Dec 5, 2024
1 parent f31cdeb commit 9749fad
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ jobs:
test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}
github_sha: ${{github.sha}}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
connection_port: ${{vars.LINUX_CONNECTION_PORT}}


# StartLocalStackITAR:
# name: 'StartLocalStackITAR'
Expand Down Expand Up @@ -619,6 +621,8 @@ jobs:
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
github_sha: ${{github.sha}}
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }}
connection_port: ${{vars.LINUX_CONNECTION_PORT}}


# StopLocalStackITAR:
# name: 'StopLocalStackITAR'
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/start-localstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ on:
type: string
s3_integration_bucket:
type: string
connection_port:
type: number
required: true
outputs:
local_stack_host_name:
value: ${{ jobs.StartLocalStack.outputs.local_stack_host_name }}
Expand Down Expand Up @@ -57,6 +60,16 @@ jobs:
role-to-assume: ${{ inputs.terraform_assume_role }}
aws-region: ${{ inputs.region }}


- name: Add Runner to Security Group
uses: mnavarrocarter/[email protected]
with:
aws-region: ${{inputs.region}}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-security-group-id: ${{ secrets.AWS_TERRAFORM_SECURITY_GROUP_ID }}
protocol: 'tcp'
port: ${{ inputs.connection_port }}
- name: Echo Localstack Config
run: echo repo name ${{inputs.test_repo_name}} repo branch ${{ inputs.test_repo_branch }} region ${{ inputs.region }}

Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/stop-localstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ on:
type: string
s3_integration_bucket:
type: string

connection_port:
type: number
required: true

jobs:
StopLocalStack:
Expand All @@ -50,6 +52,16 @@ jobs:
role-to-assume: ${{ inputs.terraform_assume_role }}
aws-region: ${{ inputs.region }}


- name: Add Runner to Security Group
uses: mnavarrocarter/[email protected]
with:
aws-region: ${{inputs.region}}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-security-group-id: ${{ secrets.AWS_TERRAFORM_SECURITY_GROUP_ID }}
protocol: 'tcp'
port: ${{ inputs.connection_port }}
- name: Copy state
run: aws s3 cp s3://${{inputs.s3_integration_bucket}}/integration-test/local-stack-terraform-state/${{inputs.github_sha}}/terraform.tfstate .

Expand Down

0 comments on commit 9749fad

Please sign in to comment.