Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace illegal variable defined using other variable #389

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/build-and-release-to-spin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ env:
IS_PROD_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }}

jobs:
setup-variables:
runs-on: ubuntu-latest
steps:
- name: Set variables
run: |
echo "IS_PROD_RELEASE=${{ startsWith(github.ref, 'refs/tags/v') }}" >> "$GITHUB_ENV"
echo "RANCHER_NAMESPACE=${{ startsWith(github.ref, 'refs/tags/v') && 'nmdc' || 'nmdc-dev' }}" >> "$GITHUB_ENV"
Copy link
Collaborator

@eecavanna eecavanna Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-merge note to myself:

startsWith here is a GitHub Actions Expression:

This "ternary operator"-like behavior is documented in the following example in the GitHub Actions Expressions documentation:

env:
  MY_ENV_VAR: ${{ github.ref == 'refs/heads/main' && 'value_for_main_branch' || 'value_for_other_branches' }}


build:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -70,11 +78,9 @@ jobs:
deployment: [ runtime-api, dagster-dagit, dagster-daemon ]

steps:
- name: Set env var
run: echo "NAMESPACE=${{ env.IS_PROD_RELEASE && 'nmdc' || 'nmdc-dev' }}" >> "$GITHUB_ENV"
- name: Redeploy ${{ env.NAMESPACE }}:${{ matrix.deployment }}
- name: Redeploy ${{ env.RANCHER_NAMESPACE }}:${{ matrix.deployment }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good call taking NAMESPACE to RANCHER_NAMESPACE.

uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.RANCHER_URL }}/v3/project/${{ secrets.RANCHER_CONTEXT }}/workloads/deployment:${{ env.NAMESPACE }}:${{ matrix.deployment }}?action=redeploy
url: ${{ secrets.RANCHER_URL }}/v3/project/${{ secrets.RANCHER_CONTEXT }}/workloads/deployment:${{ env.RANCHER_NAMESPACE }}:${{ matrix.deployment }}?action=redeploy
method: POST
bearerToken: ${{ secrets.RANCHER_TOKEN }}