diff --git a/.github/workflows/test-core.yaml b/.github/workflows/test-core.yaml index 9b006697d1..66e668e127 100644 --- a/.github/workflows/test-core.yaml +++ b/.github/workflows/test-core.yaml @@ -1,4 +1,5 @@ name: Core CI Tests + on: pull_request: paths-ignore: @@ -21,6 +22,7 @@ on: branches: - main - release/** + - f-NET-11243 paths-ignore: - 'README.md' - 'CHANGELOG.md' @@ -49,78 +51,91 @@ env: jobs: checks: uses: ./.github/workflows/checks.yaml - compile: - needs: [checks] - strategy: - fail-fast: false - matrix: - os: [ubuntu-24.04, macos-14, windows-2019] - runs-on: ${{matrix.os}} - timeout-minutes: 20 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 - with: - cache: ${{ contains(runner.name, 'Github Actions') }} - go-version-file: .go-version - cache-dependency-path: '**/go.sum' - - name: Run make dev - run: | - make bootstrap - make dev - tests-api: - needs: [checks] - runs-on: custom-linux-xl-nomad-22.04 - timeout-minutes: 8 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 - with: - cache: true - go-version-file: .go-version - cache-dependency-path: '**/go.sum' - - name: Run API tests - env: - GOTEST_MOD: api - run: | - make bootstrap - make generate-all - sudo sed -i 's!Defaults!#Defaults!g' /etc/sudoers - sudo -E env "PATH=$PATH" make test-nomad-module - tests-groups: - needs: [checks] - runs-on: ubuntu-22.04 - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - groups: - - nomad - - client - - command - - drivers - - quick - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 - with: - cache: ${{ contains(runner.name, 'Github Actions') }} - go-version-file: .go-version - cache-dependency-path: '**/go.sum' - - name: Install optional dependencies - if: ${{ matrix.groups == 'drivers' }} - run: sudo apt update && sudo apt install qemu-system - - name: Run Matrix Tests - env: - GOTEST_GROUP: ${{matrix.groups}} - run: | - make bootstrap - make generate-all - make dev - sudo -E env "PATH=$PATH" hc-install install -version ${{env.VAULT_VERSION}} -path '${{env.GOPATH}}/bin' vault - sudo -E env "PATH=$PATH" hc-install install -version ${{env.CONSUL_VERSION}} -path '${{env.GOPATH}}/bin' consul - sudo sed -i 's!Defaults!#Defaults!g' /etc/sudoers - sudo -E env "PATH=$PATH" make test-nomad +# compile: +# needs: [checks] +# strategy: +# fail-fast: false +# matrix: +# os: [ubuntu-24.04, macos-14, windows-2019] +# runs-on: ${{matrix.os}} +# timeout-minutes: 20 +# steps: +# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 +# - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 +# with: +# cache: ${{ contains(runner.name, 'Github Actions') }} +# go-version-file: .go-version +# cache-dependency-path: '**/go.sum' +# - name: Run make dev +# run: | +# make bootstrap +# make dev +# tests-api: +# needs: [checks] +# runs-on: custom-linux-xl-nomad-22.04 +# timeout-minutes: 8 +# steps: +# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 +# - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 +# with: +# cache: true +# go-version-file: .go-version +# cache-dependency-path: '**/go.sum' +# - name: Run API tests +# env: +# GOTEST_MOD: api +# run: | +# make bootstrap +# make generate-all +# sudo sed -i 's!Defaults!#Defaults!g' /etc/sudoers +# sudo -E env "PATH=$PATH" make test-nomad-module +# tests-groups: +# needs: [checks] +# runs-on: ubuntu-22.04 +# timeout-minutes: 30 +# strategy: +# fail-fast: false +# matrix: +# groups: +# - nomad +# - client +# - command +# - drivers +# - quick +# steps: +# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 +# - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 +# with: +# cache: ${{ contains(runner.name, 'Github Actions') }} +# go-version-file: .go-version +# cache-dependency-path: '**/go.sum' +# - name: Install optional dependencies +# if: ${{ matrix.groups == 'drivers' }} +# run: sudo apt update && sudo apt install qemu-system +# - name: Run Matrix Tests +# env: +# GOTEST_GROUP: ${{matrix.groups}} +# run: | +# make bootstrap +# make generate-all +# make dev +# sudo -E env "PATH=$PATH" hc-install install -version ${{env.VAULT_VERSION}} -path '${{env.GOPATH}}/bin' vault +# sudo -E env "PATH=$PATH" hc-install install -version ${{env.CONSUL_VERSION}} -path '${{env.GOPATH}}/bin' consul +# sudo sed -i 's!Defaults!#Defaults!g' /etc/sudoers +# sudo -E env "PATH=$PATH" make test-nomad + + handle-failure: + needs: + - checks + if: | + always() && github.event_name == 'push' && needs.checks.result == 'failure' + uses: ./.github/workflows/test-failure-notification.yml + with: + actor: ${{ github.triggering_actor }} + git-branch: ${{ github.ref_name }} + workflow-run-id: ${{ github.run_id }} + workflow-name: ${{ github.workflow }} + permissions: contents: read id-token: write diff --git a/.github/workflows/test-failure-notification.yml b/.github/workflows/test-failure-notification.yml new file mode 100644 index 0000000000..99c28eaaf2 --- /dev/null +++ b/.github/workflows/test-failure-notification.yml @@ -0,0 +1,73 @@ +name: CI Test Failure Notification + +on: + workflow_call: + inputs: + actor: + description: 'Triggering actor of the failed the workflow' + required: true + type: string + git-branch: + description: 'Git branch name' + required: true + type: string + workflow-name: + description: 'Name of the GitHub Action workflow' + required: true + type: string + workflow-run-id: + description: 'GitHub Action run ID that failed' + required: true + type: string + +jobs: + send-notification: + runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-latest' }} + steps: + - name: Retrieve Vault-hosted Secrets + if: endsWith(github.repository, '-enterprise') + id: vault + uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c # v3.0.0 + with: + url: ${{ vars.CI_VAULT_URL }} + method: ${{ vars.CI_VAULT_METHOD }} + path: ${{ vars.CI_VAULT_PATH }} + jwtGithubAudience: ${{ vars.CI_VAULT_AUD }} + secrets: |- + kv/data/teams/nomad/slack-webhooks feed-nomad | SLACK_FEED_NOMAD ; + - name: Send Slack notification + uses: slackapi/slack-github-action@v2.0.0 + with: + webhook: ${{ env.SLACK_FEED_NOMAD || secrets.SLACK_FEED_NOMAD_CI_FAILURE }} + webhook-type: incoming-webhook + payload: | + { + "text": ":x: CI Workflow '${{ inputs.workflow-name }}' *FAILED*", + "attachments": [ + { + "color": "#C41E3A", + "blocks": [ + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Branch:* <${{ github.server_url }}/${{ github.repository }}/tree/${{ inputs.git-branch }}|${{ inputs.git-branch }}>" + }, + { + "type": "mrkdwn", + "text": "*From:* @${{ inputs.actor }}" + }, + { + "type": "mrkdwn", + "text": "*Run:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ inputs.workflow-run-id }}|${{ inputs.workflow-run-id }}>" + } + ] + } + ] + } + ] + } +permissions: + contents: read + id-token: write \ No newline at end of file diff --git a/go.mod b/go.mod index 2a7bcb1320..e474b69df6 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ replace github.com/hashicorp/nomad/api => ./api require ( github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5 - github.com/Masterminds/sprig/v3 v3.2.3 + github.com/Masterminds/sprig/v3 v3.3.0 github.com/Microsoft/go-winio v0.6.1 github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e github.com/armon/go-metrics v0.5.3 @@ -146,7 +146,7 @@ require ( cloud.google.com/go/iam v1.1.2 // indirect cloud.google.com/go/kms v1.15.2 // indirect cloud.google.com/go/storage v1.30.1 // indirect - dario.cat/mergo v1.0.0 // indirect + dario.cat/mergo v1.0.1 // indirect github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect @@ -168,7 +168,7 @@ require ( github.com/BurntSushi/toml v1.3.2 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/semver/v3 v3.3.0 // indirect github.com/VividCortex/ewma v1.1.1 // indirect github.com/agext/levenshtein v1.2.1 // indirect github.com/apparentlymart/go-cidr v1.0.1 // indirect @@ -235,7 +235,7 @@ require ( github.com/hashicorp/mdns v1.0.4 // indirect github.com/hashicorp/vault/api/auth/kubernetes v0.5.0 // indirect github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443 // indirect - github.com/huandu/xstrings v1.4.0 // indirect + github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07 // indirect github.com/jefferai/isbadcipher v0.0.0-20190226160619-51d2077c035f // indirect @@ -271,10 +271,10 @@ require ( github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect github.com/seccomp/libseccomp-golang v0.10.0 // indirect - github.com/shopspring/decimal v1.3.1 // indirect + github.com/shopspring/decimal v1.4.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d // indirect - github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/cast v1.7.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect github.com/tencentcloud/tencentcloud-sdk-go v1.0.162 // indirect