From dcf5e04b04573f4ce79697bfdaed0276959dd776 Mon Sep 17 00:00:00 2001 From: Sergei Lukianov Date: Thu, 9 Jan 2025 17:07:50 -0800 Subject: [PATCH] Make hw CI job work Signed-off-by: Sergei Lukianov --- .github/workflows/ci-hw.yaml | 41 ++++++++++++++++++++++++++++++------ cmd/hhfab/main.go | 1 + 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-hw.yaml b/.github/workflows/ci-hw.yaml index 3791cdd7..cdee24fe 100644 --- a/.github/workflows/ci-hw.yaml +++ b/.github/workflows/ci-hw.yaml @@ -1,12 +1,32 @@ -name: CI +name: CI-HW concurrency: - group: hwci-${{ github.head_ref || github.run_id }} + group: ci-hw-${{ github.head_ref || github.run_id }} cancel-in-progress: true on: + push: + branches: + - master + - release/* + tags: + - "v*" + pull_request: + types: [ labeled ] + schedule: + - cron: "0 10 * * *" # ~2am PST workflow_dispatch: inputs: + keep: + type: boolean + description: "Don't exit when done" + required: false + default: false + skip_ready: + type: boolean + description: "Skip ready checks" + required: false + default: false debug_enabled: type: boolean description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" @@ -14,7 +34,8 @@ on: default: false jobs: - vlab: + hlab: + if: contains(github.event.pull_request.labels.*.name, 'ci-hw') runs-on: hlab timeout-minutes: 600 @@ -36,6 +57,12 @@ jobs: with: fetch-depth: 0 + - name: Checkout lab-ci repository + uses: actions/checkout@v4 + with: + repository: githedgehog/lab-ci + path: './lab-ci' + - name: Setup Go uses: actions/setup-go@v5 with: @@ -54,9 +81,9 @@ jobs: env: HHFAB_REG_REPO: 127.0.0.1:30000 run: | - bin/hhfab init -v --dev -m ${{ matrix.fabricmode }} --include-onie=${{ matrix.includeonie }} - bin/hhfab vlab gen -v - bin/hhfab vlab up -v --ready setup-vpcs --ready test-connectivity --ready exit --mode=${{ matrix.buildmode }} + source "./lab-ci/envs/$KUBE_NODE/source.sh" + bin/hhfab init -v --dev --include-onie=${{ matrix.includeonie }} -w "./lab-ci/envs/$KUBE_NODE/wiring.yaml" + bin/hhfab vlab up -v --ready switch-reinstall ${{ inputs.skip_ready && '' || '--ready setup-vpcs --ready test-connectivity' }} ${{ inputs.keep && '' || '--ready exit' }} --mode=${{ matrix.buildmode }} - name: Dump local registry logs if: ${{ always() }} @@ -66,6 +93,6 @@ jobs: - name: Setup tmate session for debug if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} uses: mxschmitt/action-tmate@v3 - timeout-minutes: 30 + timeout-minutes: 600 with: limit-access-to-actor: true diff --git a/cmd/hhfab/main.go b/cmd/hhfab/main.go index 6d397daa..8fae7fef 100644 --- a/cmd/hhfab/main.go +++ b/cmd/hhfab/main.go @@ -390,6 +390,7 @@ func Run(ctx context.Context) error { Aliases: []string{"mode", "m"}, Usage: "set fabric mode: one of " + strings.Join(fabricModes, ", "), Value: string(meta.FabricModeSpineLeaf), + EnvVars: []string{"HHFAB_FABRIC_MODE"}, Action: func(_ *cli.Context, mode string) error { if !slices.Contains(fabricModes, mode) { return fmt.Errorf("invalid fabric mode %q", mode) //nolint:goerr113