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

ci: simplify if statements in workflows #1159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
packages: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- if: ${{ !inputs.self-hosted }}
- if: (!inputs.self-hosted)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the parentheses here?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, otherwise it's interpreted as yaml foo

uses: ./.github/actions/setup_nix
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -44,7 +44,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ !inputs.self-hosted }}
- if: (!inputs.self-hosted)
name: Login to Azure
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
with:
Expand All @@ -57,11 +57,11 @@ jobs:
azure_resource_group=${{ env.azure_resource_group }}
default_platform=${{ inputs.platform }}
EOF
- if: ${{ !inputs.self-hosted }}
- if: (!inputs.self-hosted)
name: Get credentials for CI cluster
run: |
just get-credentials
- if: ${{ !inputs.self-hosted }}
- if: (!inputs.self-hosted)
name: Set sync environment
run: |
sync_ip=$(kubectl get svc sync -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
name: e2e_pod_logs-${{ inputs.platform }}-${{ inputs.test-name }}
path: workspace/logs/export/logs
- name: Notify teams channel of failure
if: ${{ failure() && github.event_name == 'schedule' && github.run_attempt == 1 }}
if: failure() && github.event_name == 'schedule' && github.run_attempt == 1
uses: ./.github/actions/post_to_teams
with:
webhook: ${{ secrets.TEAMS_CI_WEBHOOK }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_aks_runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
name: e2e_pod_logs-AKS-CLH-SNP-aks-runtime
path: workspace/logs/export/logs
- name: Notify teams channel of failure
if: ${{ failure() && github.event_name == 'schedule' && github.run_attempt == 1 }}
if: failure() && github.event_name == 'schedule' && github.run_attempt == 1
uses: ./.github/actions/post_to_teams
with:
webhook: ${{ secrets.TEAMS_CI_WEBHOOK }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e_runtime-reproducibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
name: ${{ matrix.build-target }}-${{ matrix.os }}-checksums
path: ${{ matrix.build-target }}-${{ matrix.os }}-*_checksum.txt
- name: Notify teams channel of failure
if: ${{ failure() && github.ref == 'main' && github.run_attempt == 1 }}
if: failure() && github.ref == 'main' && github.run_attempt == 1
uses: ./.github/actions/post_to_teams
with:
webhook: ${{ secrets.TEAMS_CI_WEBHOOK }}
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
exit(1)
print("All checksums were equal")
- name: Notify teams channel of failure
if: ${{ failure() && github.ref == 'main' && github.run_attempt == 1 }}
if: failure() && github.ref == 'main' && github.run_attempt == 1
uses: ./.github/actions/post_to_teams
with:
webhook: ${{ secrets.TEAMS_CI_WEBHOOK }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ jobs:
needs: release
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- if: ${{ !matrix.platform.self-hosted }}
- if: (!matrix.platform.self-hosted)
uses: ./.github/actions/setup_nix
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -405,11 +405,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Azure
if: ${{ !matrix.platform.self-hosted }}
if: (!matrix.platform.self-hosted)
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
with:
creds: ${{ secrets.CONTRAST_CI_INFRA_AZURE }}
- if: ${{ !matrix.platform.self-hosted }}
- if: (!matrix.platform.self-hosted)
uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1.2.1
- name: Create justfile.env
run: |
Expand All @@ -419,7 +419,7 @@ jobs:
default_platform=${{ matrix.platform.name }}
EOF
- name: Get credentials for CI cluster
if: ${{ !matrix.platform.self-hosted }}
if: (!matrix.platform.self-hosted)
run: |
just get-credentials
- name: E2E Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/require_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
documentation
no changelog
do-not-merge:
if: ${{ contains(github.event.pull_request.labels.*.name, 'do not merge') }}
if: contains(github.event.pull_request.labels.*.name, 'do not merge')
runs-on: ubuntu-22.04
steps:
- name: prevent merge
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rpm_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
author: edgelessci <[email protected]>
token: ${{ secrets.NUNKI_CI_COMMIT_PUSH_PR }}
- name: Notify teams channel of failure
if: ${{ failure() && github.ref == 'main' && github.run_attempt == 1 }}
if: failure() && github.ref == 'main' && github.run_attempt == 1
uses: ./.github/actions/post_to_teams
with:
webhook: ${{ secrets.TEAMS_CI_WEBHOOK }}
Expand Down