Update OTel Collector to 0.158.0/1.64.0 #168
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build" | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| types: | |
| - "opened" | |
| - "reopened" | |
| - "synchronize" | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| # Forces usage of Git Bash on Windows which makes the bash steps work. | |
| shell: "bash" | |
| env: | |
| NFPM_VERSION: "v2.46.3" | |
| jobs: | |
| # We need a stable timestamp for all jobs because it's part of artifact names | |
| # and paths. | |
| init: | |
| runs-on: "ubuntu-slim" | |
| outputs: | |
| timestamp: "${{ steps.timestamp.outputs.value }}" | |
| steps: | |
| - name: "Create build timestamp" | |
| id: "timestamp" | |
| run: > | |
| echo "value=$(date --utc '+%Y%m%d-%H%M%S')" >> "$GITHUB_OUTPUT" | |
| build: | |
| needs: "init" | |
| strategy: | |
| matrix: | |
| os: ["linux", "windows"] | |
| runs-on: "${{ case(matrix.os == 'windows', format('runs-on={0}/runner=windows25-4-core', github.run_id), 'ubuntu-latest') }}" | |
| steps: | |
| - name: "Checkout repository" | |
| uses: "actions/checkout@v6" | |
| with: | |
| persist-credentials: false | |
| - name: "Setup Go environment" | |
| uses: "actions/setup-go@v6" | |
| with: | |
| go-version-file: "go.mod" | |
| check-latest: true | |
| - name: "Build binaries" | |
| run: "go tool task all" | |
| - name: "Run tests" | |
| run: "go tool task test" | |
| - name: "Setup env" | |
| run: | | |
| # NOTE: Use UPPERCASE names here. They are inherited by later steps | |
| # as-is. Windows environment variables are case-insensitive! | |
| { | |
| echo "TIMESTAMP=${{ needs.init.outputs.timestamp }}" | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| echo "SNAPSHOT_PATH=pull-request/${{ needs.init.outputs.timestamp }}-run-${{ github.run_id }}-pr-${{ github.event.number }}" | |
| else | |
| echo "SNAPSHOT_PATH=$BRANCH_NAME/${{ needs.init.outputs.timestamp }}-run-${{ github.run_id }}" | |
| fi | |
| } | tee -a "$GITHUB_ENV" | |
| env: | |
| # See: https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks | |
| BRANCH_NAME: "${{ github.head_ref || github.ref_name }}" | |
| - name: "Setup nFPM" | |
| if: "matrix.os == 'linux'" | |
| run: "go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}" | |
| - name: "Build Linux packages" | |
| if: "matrix.os == 'linux'" | |
| run: "go tool task package:linux" | |
| - name: "Build Windows packages" | |
| if: "matrix.os == 'windows'" | |
| run: "go tool task package:windows:msi" # TODO: Add code signing! | |
| - name: "Upload build artifacts to S3" | |
| # Dependabot doesn't have access to the S3 secrets. | |
| if: "github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]')" | |
| env: | |
| AWS_DEFAULT_REGION: "eu-west-1" | |
| AWS_ACCESS_KEY_ID: "${{ secrets.AWS_S3_SNAPSHOTS_ACCESS_KEY_ID }}" | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SNAPSHOTS_SECRET_ACCESS_KEY }} | |
| AWS_S3_BUCKET: "${{ secrets.AWS_S3_SNAPSHOTS_BUCKET }}" | |
| working-directory: "target" | |
| run: | | |
| printf -- "## Artifacts - ${{ matrix.os }}\n\n" >> "$GITHUB_STEP_SUMMARY" | |
| for file in $(find . -maxdepth 1 -name 'graylog-collector*' -type f | grep ${{ case(matrix.os == 'windows', '', '-v') }} -e '\.exe$' -e '\.msi$' | sort -V); do | |
| aws s3 cp --no-progress "$file" "s3://${AWS_S3_BUCKET}/collector/${SNAPSHOT_PATH}/" | |
| printf -- "- https://downloads.graylog.org/snapshots/collector/%s/%s\n" "$SNAPSHOT_PATH" "$(basename "$file")" >> "$GITHUB_STEP_SUMMARY" | |
| done | |
| - name: "Upload artifacts" | |
| # Dependabot can't upload to S3, let's archive the artifacts for testing. | |
| if: "github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'" | |
| uses: "actions/upload-artifact@v7" | |
| with: | |
| name: "collector-build-artifacts-${{ matrix.os }}" | |
| path: "target/graylog-collector*" | |
| retention-days: 7 |