Skip to content

Commit

Permalink
Merge pull request #6 from stack-spot/stg-dump
Browse files Browse the repository at this point in the history
Dump main
  • Loading branch information
RodrigoCuryZup authored Feb 21, 2024
2 parents 6b5333a + 679a9c7 commit 4f26dfc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- name: DESTROY
if: contains( matrix.task.taskType , 'DESTROY')
uses: stack-spot/runtime-destroy-action@v1
uses: stack-spot/runtime-destroy-action@v2
with:
FEATURES_LEVEL_LOG: debug
CLIENT_ID: ${{ secrets.CLIENT_ID }}
Expand All @@ -36,9 +36,13 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
AWS_REGION: sa-east-1
REPOSITORY_NAME: my-repository-name
RUN_TASK_ID: ${{ matrix.task.runTaskId }}
CONTAINER_URL: my/container-url # not mandatory
FEATURES_TERRAFORM_MODULES: ... # not mandatory
PATH_TO_MOUNT: path/to/mount
```
* * *
Expand All @@ -54,12 +58,13 @@ Field | Mandatory | Observation
**AWS_ACCESS_KEY_ID** | NO | [AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) Access Key ID
**AWS_SECRET_ACCESS_KEY** | NO | [AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) Secret Access Key
**AWS_SESSION_TOKEN** | NO | [AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) Session Token
**AWS_ROLE_ARN** | NO | AWS Role ARN
**AWS_ROLE_ARN** | NO | AWS IAM ROLE (necessary if AWS credentials not informed)
**AWS_REGION** | YES | AWS region where resources with be provisioned. Used for tf backend as well (e.g: `us-east-1`).
**RUN_TASK_ID** | YES | StackSpot Runtime task id to be executed, according to [runtime-manager-action](https://github.com/stack-spot/runtime-manager-action).
**REPOSITORY_NAME** | YES | Repository name to checkout during task process.
**CONTAINER_URL** | NO | Container url reference (e.g `stackspot/image`)
**FEATURES_TERRAFORM_MODULES** | NO | List of external terraform modules allowed

**PATH_TO_MOUNT** | YES | Path provided to be used as a volume within the docker image that will be used with terraform

* * *

Expand Down
20 changes: 15 additions & 5 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ inputs:
RUN_TASK_ID:
description: "Runtime Run Task Id"
required: true
CONTAINER_URL:
description: "Destroy Container url"
default: stackspot/runtime-job-destroy
FEATURES_TERRAFORM_MODULES:
description: "Terraform Modules"
required: false
PATH_TO_MOUNT:
description: "Path to mount inside the docker"
required: true
default: ${{ github.workspace }}

runs:
using: "composite"
Expand All @@ -55,10 +62,11 @@ runs:
aws-region: ${{ inputs.AWS_REGION }}
output-credentials: true

- name: Run Runtime Action Deploy
- name: Run Runtime Action Destroy
if: ${{ inputs.AWS_ROLE_ARN == 0 }}
run: |
docker run --rm \
-v ${{ inputs.PATH_TO_MOUNT }}:/app-volume \
-e FEATURES_LEVEL_LOG=${{ inputs.FEATURES_LEVEL_LOG }} \
-e AUTHENTICATE_CLIENT_ID=${{ inputs.CLIENT_ID }} \
-e AUTHENTICATE_CLIENT_SECRET=${{ inputs.CLIENT_KEY }} \
Expand All @@ -76,13 +84,14 @@ runs:
-e AWS_REGION=${{ inputs.AWS_REGION }} \
-e FEATURES_TERRAFORM_MODULES='${{ inputs.FEATURES_TERRAFORM_MODULES }}' \
--entrypoint=/app/stackspot-runtime-job-destroy \
stackspot/runtime-job-destroy:stg start --run-task-id="${{ inputs.RUN_TASK_ID }}"
${{ inputs.CONTAINER_URL }}:stg start --run-task-id="${{ inputs.RUN_TASK_ID }}"
shell: bash

- name: Run Runtime Action Deploy
- name: Run Runtime Action Destroy
if: ${{ inputs.AWS_ROLE_ARN != 0 }}
run: |
docker run --rm \
-v ${{ inputs.PATH_TO_MOUNT }}:/app-volume \
-e FEATURES_LEVEL_LOG=${{ inputs.FEATURES_LEVEL_LOG }} \
-e AUTHENTICATE_CLIENT_ID=${{ inputs.CLIENT_ID }} \
-e AUTHENTICATE_CLIENT_SECRET=${{ inputs.CLIENT_KEY }} \
Expand All @@ -99,8 +108,9 @@ runs:
-e AWS_SESSION_TOKEN=${{ steps.aws-cred.outputs.aws-session-token }} \
-e AWS_REGION=${{ inputs.AWS_REGION }} \
-e FEATURES_TERRAFORM_MODULES='${{ inputs.FEATURES_TERRAFORM_MODULES }}' \
--entrypoint=/app/stackspot-runtime-job-deploy \
stackspot/runtime-job-deploy:stg start --run-task-id="${{ inputs.RUN_TASK_ID }}"
--entrypoint=/app/stackspot-runtime-job-destroy \
${{ inputs.CONTAINER_URL }}:stg start --run-task-id="${{ inputs.RUN_TASK_ID }}"
shell: bash

branding:
Expand Down

0 comments on commit 4f26dfc

Please sign in to comment.