1
0
mirror of https://github.com/nginxinc/nginx-prometheus-exporter.git synced 2025-10-25 11:57:38 +03:00

Update CI to address deprecation notices, remove assertion docs and fix go_proxy variable (#1170)

Co-authored-by: Alex Fenlon <a.fenlon@f5.com>
This commit is contained in:
Paul Abel
2025-10-13 17:06:09 +01:00
committed by GitHub
parent 6135194fa1
commit c78c6ead44
3 changed files with 147 additions and 148 deletions

View File

@@ -37,13 +37,12 @@ jobs:
forked_workflow=${{ (github.event.pull_request && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || github.repository != 'nginx/nginx-prometheus-exporter' }} forked_workflow=${{ (github.event.pull_request && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || github.repository != 'nginx/nginx-prometheus-exporter' }}
echo "forked_workflow=${forked_workflow}" >> $GITHUB_OUTPUT echo "forked_workflow=${forked_workflow}" >> $GITHUB_OUTPUT
if [ "$forked_workflow" = "false" ] && [ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]; then if [ "$forked_workflow" = "false" ] && [ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]; then
go_proxy="${{ secrets.ARTIFACTORY_DEV_ENDPOINT }}" go_proxy="${{ secrets.ARTIFACTORY_DEV_ENDPOINT }}" >> $GITHUB_OUTPUT
elif [ "${{ github.ref_name }}" = "${{ github.event.repository.default_branch }}" ]; then elif [ "${{ github.ref_name }}" = "${{ github.event.repository.default_branch }}" ]; then
go_proxy="${{ secrets.ARTIFACTORY_ENDPOINT }}" go_proxy="${{ secrets.ARTIFACTORY_ENDPOINT }}" >> $GITHUB_OUTPUT
else else
go_proxy="https://proxy.golang.org,direct" go_proxy="https://proxy.golang.org,direct" >> $GITHUB_OUTPUT
fi fi
echo "go_proxy=${go_proxy}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT cat $GITHUB_OUTPUT
unit-tests: unit-tests:
@@ -257,74 +256,74 @@ jobs:
rm -f $HOME/.netrc rm -f $HOME/.netrc
if: ${{ always() }} if: ${{ always() }}
generate-assertion-doc: # generate-assertion-doc:
if: ${{ github.event_name != 'pull_request' }} # if: ${{ github.event_name != 'pull_request' }}
name: Assertion Doc ${{ matrix.prometheus.arch }} # name: Assertion Doc ${{ matrix.prometheus.os }}/${{ matrix.prometheus.arch }}
needs: [build-docker, variables] # needs: [build-docker, variables]
runs-on: ubuntu-24.04-amd64 # runs-on: ubuntu-24.04-amd64
permissions: # permissions:
contents: read # contents: read
id-token: write # for compliance-rules action to sign assertion doc # id-token: write # for compliance-rules action to sign assertion doc
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
prometheus: ${{ fromJSON( needs.build-docker.outputs.binaries ) }} # prometheus: ${{ fromJSON( needs.build-docker.outputs.binaries ) }}
steps: # steps:
- name: Checkout Repository # - name: Checkout Repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 # uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Golang Environment # - name: Setup Golang Environment
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 # uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with: # with:
go-version-file: go.mod # go-version-file: go.mod
- name: Setup netrc # - name: Setup netrc
run: | # run: |
cat <<EOF > $HOME/.netrc # cat <<EOF > $HOME/.netrc
machine azr.artifactory.f5net.com # machine azr.artifactory.f5net.com
login ${{ secrets.ARTIFACTORY_USER }} # login ${{ secrets.ARTIFACTORY_USER }}
password ${{ secrets.ARTIFACTORY_TOKEN }} # password ${{ secrets.ARTIFACTORY_TOKEN }}
EOF # EOF
chmod 600 $HOME/.netrc # chmod 600 $HOME/.netrc
- name: Fetch Cached Artifacts # - name: Fetch Cached Artifacts
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 # uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with: # with:
path: ${{ github.workspace }}/dist # path: ${{ github.workspace }}/dist
key: nginx-prometheus-exporter-${{ github.sha }} # key: nginx-prometheus-exporter-${{ github.sha }}
fail-on-cache-miss: true # fail-on-cache-miss: true
- name: List packages in Go binary # - name: List packages in Go binary
id: godeps # id: godeps
env: # env:
GOPROXY: ${{ needs.variables.outputs.go_proxy }} # GOPROXY: ${{ needs.variables.outputs.go_proxy }}
run: | # run: |
go version -m ${{ matrix.prometheus.path }} > go_version_out_${{ github.run_id }}_${{ github.run_number }}.txt # go version -m ${{ matrix.prometheus.path }} > go_version_out_${{ github.run_id }}_${{ github.run_number }}.txt
echo "go_version_out=$(find -type f -name "go_version_out*.txt" | head -n 1)" >> $GITHUB_OUTPUT # echo "go_version_out=$(find -type f -name "go_version_out*.txt" | head -n 1)" >> $GITHUB_OUTPUT
echo "artifact_digest=$(openssl dgst -sha256 -r ${{ matrix.prometheus.path }} | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT # echo "artifact_digest=$(openssl dgst -sha256 -r ${{ matrix.prometheus.path }} | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT # cat $GITHUB_OUTPUT
- name: Generate Assertion Document # - name: Generate Assertion Document
id: assertiondoc # id: assertiondoc
uses: nginxinc/compliance-rules/.github/actions/assertion@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0 # uses: nginxinc/compliance-rules/.github/actions/assertion@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
with: # with:
artifact-name: "${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}" # artifact-name: "${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}"
artifact-digest: ${{ steps.godeps.outputs.artifact_digest }} # artifact-digest: ${{ steps.godeps.outputs.artifact_digest }}
build-type: "github.com" # build-type: "github.com"
builder-id: "github" # builder-id: "github"
builder-version: v0.1.0 # builder-version: v0.1.0
started-on: ${{ github.event.head_commit.timestamp }} # started-on: ${{ github.event.head_commit.timestamp }}
finished-on: ${{ github.event.head_commit.timestamp }} # finished-on: ${{ github.event.head_commit.timestamp }}
invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} # invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
artifactory-user: ${{ secrets.ARTIFACTORY_USER }} # artifactory-user: ${{ secrets.ARTIFACTORY_USER }}
artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }} # artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }}
artifactory-url: ${{ secrets.ARTIFACTORY_URL }} # artifactory-url: ${{ secrets.ARTIFACTORY_URL }}
artifactory-repo: 'f5-nginx-go-local-approved-dependency' # artifactory-repo: 'f5-nginx-go-local-approved-dependency'
assertion-doc-file: assertion_${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_id }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}.json # assertion-doc-file: assertion_${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_id }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}.json
build-content-path: ${{ steps.godeps.outputs.go_version_out }} # build-content-path: ${{ steps.godeps.outputs.go_version_out }}
- name: Sign and Store Assertion Document # - name: Sign and Store Assertion Document
id: sign # id: sign
uses: nginxinc/compliance-rules/.github/actions/sign@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0 # uses: nginxinc/compliance-rules/.github/actions/sign@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
with: # with:
assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }} # assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }}

View File

@@ -275,81 +275,81 @@ jobs:
rm -f $HOME/.netrc rm -f $HOME/.netrc
if: ${{ always() }} if: ${{ always() }}
generate-assertion-doc: # generate-assertion-doc:
if: ${{ !contains(inputs.skip_jobs, 'generate-assertion-doc') }} # if: ${{ !contains(inputs.skip_jobs, 'generate-assertion-doc') }}
name: Assertion Doc ${{ matrix.prometheus.arch }} # name: Assertion Doc ${{ matrix.prometheus.os }}/${{ matrix.prometheus.arch }}
needs: [build-docker, variables] # needs: [build-docker, variables]
runs-on: ubuntu-24.04-amd64 # runs-on: ubuntu-24.04-amd64
permissions: # permissions:
contents: read # contents: read
id-token: write # for compliance-rules action to sign assertion doc # id-token: write # for compliance-rules action to sign assertion doc
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
prometheus: ${{ fromJSON( needs.build-docker.outputs.binaries ) }} # prometheus: ${{ fromJSON( needs.build-docker.outputs.binaries ) }}
steps: # steps:
- name: Checkout Repository # - name: Checkout Repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 # uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Golang Environment # - name: Setup Golang Environment
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 # uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with: # with:
go-version-file: go.mod # go-version-file: go.mod
- name: Configure pipeline Variables # - name: Configure pipeline Variables
id: vars # id: vars
run: | # run: |
timestamp=$(date --iso-8601=seconds) # timestamp=$(date --iso-8601=seconds)
echo "timestamp=${timestamp}" >> $GITHUB_OUTPUT # echo "timestamp=${timestamp}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT # cat $GITHUB_OUTPUT
- name: Setup netrc # - name: Setup netrc
run: | # run: |
cat <<EOF > $HOME/.netrc # cat <<EOF > $HOME/.netrc
machine azr.artifactory.f5net.com # machine azr.artifactory.f5net.com
login ${{ secrets.ARTIFACTORY_USER }} # login ${{ secrets.ARTIFACTORY_USER }}
password ${{ secrets.ARTIFACTORY_TOKEN }} # password ${{ secrets.ARTIFACTORY_TOKEN }}
EOF # EOF
chmod 600 $HOME/.netrc # chmod 600 $HOME/.netrc
- name: Fetch Cached Artifacts # - name: Fetch Cached Artifacts
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 # uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with: # with:
path: ${{ github.workspace }}/dist # path: ${{ github.workspace }}/dist
key: nginx-prometheus-exporter-${{ github.sha }} # key: nginx-prometheus-exporter-${{ github.sha }}
fail-on-cache-miss: true # fail-on-cache-miss: true
- name: List packages in Go binary # - name: List packages in Go binary
id: godeps # id: godeps
env: # env:
GOPROXY: ${{ secrets.ARTIFACTORY_ENDPOINT }} # GOPROXY: ${{ secrets.ARTIFACTORY_ENDPOINT }}
run: | # run: |
go version -m ${{ matrix.prometheus.path }} > go_version_out_${{ github.run_id }}_${{ github.run_number }}.txt # go version -m ${{ matrix.prometheus.path }} > go_version_out_${{ github.run_id }}_${{ github.run_number }}.txt
echo "go_version_out=$(find -type f -name "go_version_out*.txt" | head -n 1)" >> $GITHUB_OUTPUT # echo "go_version_out=$(find -type f -name "go_version_out*.txt" | head -n 1)" >> $GITHUB_OUTPUT
echo "artifact_digest=$(openssl dgst -sha256 -r ${{ matrix.prometheus.path }} | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT # echo "artifact_digest=$(openssl dgst -sha256 -r ${{ matrix.prometheus.path }} | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT # cat $GITHUB_OUTPUT
- name: Generate Assertion Document # - name: Generate Assertion Document
id: assertiondoc # id: assertiondoc
uses: nginxinc/compliance-rules/.github/actions/assertion@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0 # uses: nginxinc/compliance-rules/.github/actions/assertion@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
with: # with:
artifact-name: "${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}" # artifact-name: "${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}"
artifact-digest: ${{ steps.godeps.outputs.artifact_digest }} # artifact-digest: ${{ steps.godeps.outputs.artifact_digest }}
build-type: "github.com" # build-type: "github.com"
builder-id: "github" # builder-id: "github"
builder-version: v0.1.0 # builder-version: v0.1.0
started-on: ${{ steps.vars.outputs.timestamp }} # started-on: ${{ steps.vars.outputs.timestamp }}
finished-on: ${{ steps.vars.outputs.timestamp }} # finished-on: ${{ steps.vars.outputs.timestamp }}
invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} # invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
artifactory-user: ${{ secrets.ARTIFACTORY_USER }} # artifactory-user: ${{ secrets.ARTIFACTORY_USER }}
artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }} # artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }}
artifactory-url: ${{ secrets.ARTIFACTORY_URL }} # artifactory-url: ${{ secrets.ARTIFACTORY_URL }}
artifactory-repo: 'f5-nginx-go-local-approved-dependency' # artifactory-repo: 'f5-nginx-go-local-approved-dependency'
assertion-doc-file: assertion_${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_id }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}.json # assertion-doc-file: assertion_${{ github.event.repository.name }}_${{ github.sha }}_${{ github.run_id }}_${{ github.run_number }}_${{ matrix.prometheus.os }}_${{ matrix.prometheus.arch }}.json
build-content-path: ${{ steps.godeps.outputs.go_version_out }} # build-content-path: ${{ steps.godeps.outputs.go_version_out }}
- name: Sign and Store Assertion Document # - name: Sign and Store Assertion Document
id: sign # id: sign
uses: nginxinc/compliance-rules/.github/actions/sign@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0 # uses: nginxinc/compliance-rules/.github/actions/sign@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
with: # with:
assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }} # assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }}

View File

@@ -44,7 +44,7 @@ changelog:
archives: archives:
- format_overrides: - format_overrides:
- goos: windows - goos: windows
format: zip formats: ['zip']
files: files:
- README.md - README.md
- LICENSE - LICENSE
@@ -71,22 +71,22 @@ signs:
milestones: milestones:
- close: true - close: true
brews: homebrew_casks:
- repository: - repository:
owner: nginx owner: nginx
name: homebrew-tap name: homebrew-tap
token: "{{ .Env.NGINX_GITHUB_TOKEN }}" token: "{{ .Env.NGINX_GITHUB_TOKEN }}"
directory: Formula directory: Casks
homepage: https://github.com/nginx/nginx-prometheus-exporter homepage: https://github.com/nginx/nginx-prometheus-exporter
description: NGINX Prometheus Exporter for NGINX and NGINX Plus description: NGINX Prometheus Exporter for NGINX and NGINX Plus
license: Apache-2.0
commit_author: commit_author:
name: nginx-bot name: nginx-bot
email: integrations@nginx.com email: integrations@nginx.com
extra_install: |- manpages:
bash_completion.install "completions/nginx-prometheus-exporter.bash" => "nginx-prometheus-exporter" - "manpages/nginx-prometheus-exporter.1.gz"
zsh_completion.install "completions/nginx-prometheus-exporter.zsh" => "_nginx-prometheus-exporter" completions:
man1.install "manpages/nginx-prometheus-exporter.1.gz" bash: "completions/nginx-prometheus-exporter.bash"
zsh: "completions/nginx-prometheus-exporter.zsh"
nix: nix:
- name: nginx-prometheus-exporter - name: nginx-prometheus-exporter