Skip to content

Commit

Permalink
get expiration in separate job (#4376)
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig O'Donnell authored Jan 22, 2024
1 parent 301ecb8 commit 5cbe169
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,18 @@ jobs:
CURRENT_TIMESTAMP=$(date +%s)
echo "name=${{ env.WORKSPACE_PREFIX }}-${CURRENT_TIMESTAMP}" >> "$GITHUB_OUTPUT"
get-workspace-expiration:
runs-on: ubuntu-latest
outputs:
expiration: ${{ steps.workspace.outputs.expiration }}
steps:
- name: Set the workspace expiration as output
id: workspace
run: |
echo "expiration=$(date -d '+2 days' '+%Y-%m-%d')" >> "$GITHUB_OUTPUT"
jumpbox:
needs: get-workspace-name
needs: [get-workspace-name, get-workspace-expiration]
runs-on: ubuntu-20.04
container:
image: hashicorp/terraform:1.0.11
Expand Down Expand Up @@ -109,8 +119,7 @@ jobs:
if: always()
working-directory: automation/jumpbox
run: |
TF_VAR_expires_on="$(date -d '+2 days' '+%Y-%m-%d')"
export TF_VAR_expires_on
export TF_VAR_expires_on="${{ needs.get-workspace-expiration.outputs.expiration }}"
terraform apply --auto-approve
- name: Notify Slack
if: failure() && github.ref_name == 'main'
Expand All @@ -129,7 +138,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.KOTS_BUILD_STATUS_SLACK_WEBHOOK_URL }}

tests:
needs: [get-workspace-name, jumpbox]
needs: [get-workspace-name, get-workspace-expiration, jumpbox]
runs-on: ubuntu-20.04
container:
image: hashicorp/terraform:1.0.11
Expand Down Expand Up @@ -245,8 +254,7 @@ jobs:
fi
export TF_VAR_kots_addon_package_url="${{ github.event.inputs.addon_package_url || inputs.addon_package_url }}"
export TF_VAR_testim_branch="master"
TF_VAR_expires_on="$(date -d '+2 days' '+%Y-%m-%d')"
export TF_VAR_expires_on
export TF_VAR_expires_on="${{ needs.get-workspace-expiration.outputs.expiration }}"
./${{ matrix.test.terraform_script }} apply
- name: Wait for instance to be ready
working-directory: automation/cluster
Expand Down

0 comments on commit 5cbe169

Please sign in to comment.