Skip to content

Commit

Permalink
upadate stg features
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsoncarmozinezup committed Aug 2, 2024
1 parent 663fd51 commit 90bcbf1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
AWS_REGION: sa-east-1
CONTAINER_URL: my/container-url # not mandatory
REPOSITORY_NAME: my-repository-name
RUN_TASK_ID: ${{ matrix.task.runTaskId }}
PATH_TO_MOUNT: path/to/mount
BASE_PATH_OUTPUT: path/to/save/file # not mandatory
CHECKOUT_BRANCH: 'true' # not mandatory
```
* * *
Expand All @@ -55,8 +59,12 @@ Field | Mandatory | Observation
**AWS_SECRET_ACCESS_KEY** | YES | [AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) Secret Access Key
**AWS_SESSION_TOKEN** | YES | [AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) Session Token
**AWS_REGION** | YES | AWS region where files will be stored (e.g: `us-east-1`).
**REPOSITORY_NAME** | YES | Repository name to checkout during task process.
**CONTAINER_URL** | NO | Container url reference (e.g `stackspot/image`)
**PATH_TO_MOUNT** | YES | Path provided to be used as a volume within the docker image that will be used with terraform
**RUN_TASK_ID** | YES | StackSpot Runtime task id to be executed, according to [runtime-manager-action](https://github.com/stack-spot/runtime-manager-action).
**BASE_PATH_OUTPUT** | NO | Folder path to save the iac.zip generated by the action.
**CHECKOUT_BRANCH** | NO | Whether or not checkout is enabled. (default: `'false'`)

* * *

Expand Down
60 changes: 38 additions & 22 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ inputs:
CLIENT_REALM:
description: "CLIENT REALM"
required: true
REPOSITORY_NAME:
description: "Git Repository Name"
required: true
AWS_ACCESS_KEY_ID:
description: "AWS ACCESS KEY ID from console"
required: false
Expand All @@ -31,13 +34,28 @@ inputs:
RUN_TASK_ID:
description: "Runtime Run Task Id"
required: true
PATH_TO_MOUNT:
description: "Path to mount inside the docker"
required: true
default: ${{ github.workspace }}
BASE_PATH_OUTPUT:
description: "Base Path Output"
required: false
CONTAINER_URL:
description: "IAC Container url"
default: stackspot/runtime-job-iac:latest
CHECKOUT_BRANCH:
description: "Whether or not checkout is enabled."
required: false
default: 'false'

runs:
using: "composite"
steps:
- name: Checkout
if: inputs.CHECKOUT_BRANCH != 'false'
uses: actions/checkout@v4

- name: Check Runner
run: echo 🤖 OS runner is $(uname)
shell: bash
Expand All @@ -52,39 +70,37 @@ runs:
output-credentials: true

- name: Run Runtime Action Iac
if: ${{ inputs.AWS_ROLE_ARN == 0 }}
run: |
docker run --rm \
FLAGS=$(echo "-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 }} \
-e AUTHENTICATE_CLIENT_REALMS=${{ inputs.CLIENT_REALM }} \
-e AUTHENTICATE_URL="https://account-keycloak.stg.stackspot.com" \
-e FEATURES_API_MANAGER="https://runtime-manager.stg.stackspot.com" \
-e AWS_ACCESS_KEY_ID=${{ inputs.AWS_ACCESS_KEY_ID }} \
-e AWS_SECRET_ACCESS_KEY=${{ inputs.AWS_SECRET_ACCESS_KEY }} \
-e AWS_SESSION_TOKEN=${{ inputs.AWS_SESSION_TOKEN }} \
-e REPOSITORY_NAME=${{ inputs.REPOSITORY_NAME }} \
-e FEATURES_BASEPATH_TMP=/tmp/runtime/deploys \
-e FEATURES_BASEPATH_EBS=/opt/runtime \
-e FEATURES_TEMPLATES_FILEPATH=/app/ \
-e FEATURES_BASEPATH_TERRAFORM=/root/.asdf/shims/terraform \
-e AWS_REGION=${{ inputs.AWS_REGION }} \
--entrypoint=/app/stackspot-runtime-job-iac \
stackspot/runtime-job-iac:rc-2.13.0 start --run-task-id="${{ inputs.RUN_TASK_ID }}" --base-path-output="${{ inputs.BASE_PATH_OUTPUT }}"
shell: bash
- name: Run Runtime Action Iac
if: ${{ inputs.AWS_ROLE_ARN != 0 }}
run: |
if [ -z "${{ inputs.AWS_ROLE_ARN }}" ]; then
FLAGS=$(echo "$FLAGS -e AWS_ACCESS_KEY_ID=${{ inputs.AWS_ACCESS_KEY_ID }}")
FLAGS=$(echo "$FLAGS -e AWS_SECRET_ACCESS_KEY=${{ inputs.AWS_SECRET_ACCESS_KEY }}")
FLAGS=$(echo "$FLAGS -e AWS_SESSION_TOKEN=${{ inputs.AWS_SESSION_TOKEN }}")
fi
if [ ! -z "${{ inputs.AWS_ROLE_ARN }}" ]; then
FLAGS=$(echo "$FLAGS -e AWS_ACCESS_KEY_ID=${{ steps.aws-cred.outputs.aws-access-key-id }}")
FLAGS=$(echo "$FLAGS -e AWS_SECRET_ACCESS_KEY=${{ steps.aws-cred.outputs.aws-secret-access-key }}")
FLAGS=$(echo "$FLAGS -e AWS_SESSION_TOKEN=${{ steps.aws-cred.outputs.aws-session-token }}")
fi
docker run --rm \
-e FEATURES_LEVEL_LOG=${{ inputs.FEATURES_LEVEL_LOG }} \
-e AUTHENTICATE_CLIENT_ID=${{ inputs.CLIENT_ID }} \
-e AUTHENTICATE_CLIENT_SECRET=${{ inputs.CLIENT_KEY }} \
-e AUTHENTICATE_CLIENT_REALMS=${{ inputs.CLIENT_REALM }} \
-e AUTHENTICATE_URL="https://account-keycloak.stg.stackspot.com" \
-e FEATURES_API_MANAGER="https://runtime-manager.stg.stackspot.com" \
-e AWS_ACCESS_KEY_ID=${{ steps.aws-cred.outputs.aws-access-key-id }} \
-e AWS_SECRET_ACCESS_KEY=${{ steps.aws-cred.outputs.aws-secret-access-key }} \
-e AWS_SESSION_TOKEN=${{ steps.aws-cred.outputs.aws-session-token }} \
-e AWS_REGION=${{ inputs.AWS_REGION }} \
$FLAGS \
--entrypoint=/app/stackspot-runtime-job-iac \
stackspot/runtime-job-iac:rc-2.13.0 start --run-task-id="${{ inputs.RUN_TASK_ID }}" --base-path-output="${{ inputs.BASE_PATH_OUTPUT }}"
${{ inputs.CONTAINER_URL }} start --run-task-id="${{ inputs.RUN_TASK_ID }}" --base-path-output="${{ inputs.BASE_PATH_OUTPUT }}"
shell: bash

branding:
Expand Down

0 comments on commit 90bcbf1

Please sign in to comment.