Skip to content

Commit

Permalink
Enh 2451 skip conditionals (#2569)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianCashProf authored Aug 2, 2024
1 parent dce1381 commit da50206
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/test_aws_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,32 @@ env:
AWS_DEFAULT_REGION: "us-west-2"
NEBARI_GH_BRANCH: ${{ github.event.inputs.branch || 'develop' }}
NEBARI_IMAGE_TAG: ${{ github.event.inputs.image-tag || 'main' }}
TF_LOG: ${{ github.event.inputs.tf-log-level || 'info' }}

TF_LOG: ${{ github.event.inputs.tf-log-level || 'info' }}
NO_PROVIDER_CREDENTIALS_aws: false

jobs:
# Used to skip cloud provider checks due to "jobs" not supporting {{ env }} variables contexts.
check-for-credentials_aws:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
provider_credentials_aws: ${{ steps.flag-check.outputs.provider_credentials_aws }}
steps:
- name: Check if user wants to run AWS integration based on credentials
id: flag-check
run: |
if [ "${{ env.NO_PROVIDER_CREDENTIALS_aws }}" == "true" ]; then
echo "::set-output name=provider_credentials_aws::0"
else
echo "::set-output name=provider_credentials_aws::1"
fi
test-aws-integration:
runs-on: ubuntu-latest
needs: check-for-credentials_aws
if: ${{ needs.check-for-credentials.outputs.provider_credentials_aws == '1' }}
permissions:
id-token: write
contents: read
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test_azure_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,34 @@ env:
NEBARI_GH_BRANCH: ${{ github.event.inputs.branch || 'develop' }}
NEBARI_IMAGE_TAG: ${{ github.event.inputs.image-tag || 'main' }}
TF_LOG: ${{ github.event.inputs.tf-log-level || 'info' }}
NO_PROVIDER_CREDENTIALS_azure: false

jobs:
# Used to skip cloud provider checks due to "jobs" not supporting {{ env }} variables contexts
check-for-credentials:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

outputs:
provider_credentials_azure: ${{ steps.flag-check.outputs.provider_credentials_azure }}

steps:

- name: Check if user wants to run Azure integration based on credentials
id: flag-check
run: |
if [ "${{ env.NO_PROVIDER_CREDENTIALS_azure }}" == "true" ]; then
echo "::set-output name=provider_credentials_azure::0"
else
echo "::set-output name=provider_credentials_azure::1"
fi
test-azure-integration:
runs-on: ubuntu-latest
needs: check-for-credentials
if: ${{ needs.check-for-credentials.outputs.provider_credentials_azure == '1' }}
permissions:
id-token: write
contents: read
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/test_do_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,33 @@ env:
NEBARI_GH_BRANCH: ${{ github.event.inputs.branch || 'develop' }}
NEBARI_IMAGE_TAG: ${{ github.event.inputs.image-tag || 'main' }}
TF_LOG: ${{ github.event.inputs.tf-log-level || 'info' }}
NO_PROVIDER_CREDENTIALS_do: false


jobs:
# Used to skip cloud provider checks due to "jobs" not supporting {{ env }} variables contexts
check-for-credentials:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
provider_credentials_do: ${{ steps.flag-check.outputs.provider_credentials_do }}
steps:
- name: Check if user wants to run Digital Ocean integration based on credentials
id: flag-check
run: |
if [ "${{ env.NO_PROVIDER_CREDENTIALS_do }}" == "true" ]; then
echo "::set-output name=provider_credentials_do::0"
else
echo "::set-output name=provider_credentials_do::1"
fi
test-do-integration:
runs-on: ubuntu-latest
needs: check-for-credentials
if: ${{ needs.check-for-credentials.outputs.provider_credentials_do == '1' }}
permissions:
id-token: write
contents: read
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/test_gcp_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,31 @@ env:
NEBARI_GH_BRANCH: ${{ github.event.inputs.branch || 'develop' }}
NEBARI_IMAGE_TAG: ${{ github.event.inputs.image-tag || 'main' }}
TF_LOG: ${{ github.event.inputs.tf-log-level || 'info' }}

NO_PROVIDER_CREDENTIALS_gcp: false

jobs:
# Used to skip cloud provider checks due to "jobs" not supporting {{ env }} variables contexts
check-for-credentials:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
provider_credentials_gcp: ${{ steps.flag-check.outputs.provider_credentials_gcp }}
steps:
- name: Check if user wants to run GCP integration based on credentials
id: flag-check
run: |
if [ "${{ env.NO_PROVIDER_CREDENTIALS_gcp }}" == "true" ]; then
echo "::set-output name=provider_credentials_gcp::0"
else
echo "::set-output name=provider_credentials_gcp::1"
fi
test-gcp-integration:
runs-on: ubuntu-latest
needs: check-for-credentials
if: ${{ needs.check-for-credentials.outputs.provider_credentials_gcp == '1' }}
permissions:
id-token: write
contents: read
Expand Down

0 comments on commit da50206

Please sign in to comment.