From 945693057371578ef820bfaf7a254e4c5bd927f9 Mon Sep 17 00:00:00 2001 From: lucasSlv Date: Tue, 2 Sep 2025 08:05:25 -0300 Subject: [PATCH 1/3] refactor: remove unused artifact inputs and simplify environment checks --- .github/workflows/promote.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index f069fc71..7681ab7e 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -12,12 +12,6 @@ on: TO_ENV: type: string required: true - ARTIFACT_ID: - type: string - required: false # only used for dev - ARTIFACT_RUN_ID: - type: string - required: false secrets: WF_GITHUB_TOKEN: required: true @@ -89,28 +83,22 @@ jobs: fi echo "service_name=$SERVICE_NAME" >> $GITHUB_OUTPUT - - name: Download dev artifact (only if FROM_ENV is dev) - if: ${{ inputs.FROM_ENV == 'dev' }} - uses: actions/download-artifact@v4 - with: - name: service-${{ steps.serviceName.outputs.service_name }}-dev-${{ inputs.ARTIFACT_ID }} - path: dev-meta - github-token: ${{ secrets.WF_GITHUB_TOKEN }} - run-id: ${{ inputs.ARTIFACT_RUN_ID }} - - name: Ensure .deploys/service.json exists run: | mkdir -p .deploys [ -f .deploys/service.json ] || echo '{}' > .deploys/service.json + - name: Guardrail - allow only staging -> prod + run: | + if [ "${{ inputs.FROM_ENV }}" != "staging" ] || [ "${{ inputs.TO_ENV }}" != "prod" ]; then + echo "Promote allowed only from staging -> prod." + exit 1 + fi + - name: Promote image metadata id: promote run: | - if [[ "${{ inputs.FROM_ENV }}" == "dev" ]]; then - cp dev-meta/service.json from.json - else - cp .deploys/service.json from.json - fi + cp .deploys/service.json from.json echo "📦 Loaded metadata from ${{ inputs.FROM_ENV }}" cat from.json From 487a59bc253aa2f25d5194367ee57a730d722ace Mon Sep 17 00:00:00 2001 From: lucasSlv Date: Tue, 2 Sep 2025 08:56:50 -0300 Subject: [PATCH 2/3] fix: update guardrail message to reflect environment naming --- .github/workflows/promote.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 7681ab7e..9647dcaa 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -88,10 +88,10 @@ jobs: mkdir -p .deploys [ -f .deploys/service.json ] || echo '{}' > .deploys/service.json - - name: Guardrail - allow only staging -> prod + - name: Guardrail - allow only stage -> prod run: | - if [ "${{ inputs.FROM_ENV }}" != "staging" ] || [ "${{ inputs.TO_ENV }}" != "prod" ]; then - echo "Promote allowed only from staging -> prod." + if [ "${{ inputs.FROM_ENV }}" != "stage" ] || [ "${{ inputs.TO_ENV }}" != "prod" ]; then + echo "Promote allowed only from stage -> prod." exit 1 fi From 27cbb04d773d351f7656185b9e4fc70d4df5b49b Mon Sep 17 00:00:00 2001 From: lucasSlv Date: Tue, 2 Sep 2025 09:03:02 -0300 Subject: [PATCH 3/3] fix: update guardrail message to reflect correct environment names --- .github/workflows/promote.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 9647dcaa..cd713dc2 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -88,10 +88,10 @@ jobs: mkdir -p .deploys [ -f .deploys/service.json ] || echo '{}' > .deploys/service.json - - name: Guardrail - allow only stage -> prod + - name: Guardrail - allow only staging -> production run: | - if [ "${{ inputs.FROM_ENV }}" != "stage" ] || [ "${{ inputs.TO_ENV }}" != "prod" ]; then - echo "Promote allowed only from stage -> prod." + if [ "${{ inputs.FROM_ENV }}" != "staging" ] || [ "${{ inputs.TO_ENV }}" != "production" ]; then + echo "Promote allowed only from staging -> production." exit 1 fi