Skip to content

Workflow file for this run

name: Create prerelease artifacts
on:
release:
types:
- prereleased
tags:
- 'v*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INTEGRATION: "docker"
ORIGINAL_REPO_NAME: 'newrelic/nri-docker'
REPO_FULL_NAME: ${{ github.event.repository.full_name }}
TAG: ${{ github.event.release.tag_name }}
jobs:
validate:
name: Validate code via linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate code
run: make ci/validate
test-nix:
name: Run unit tests on *Nix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Unit tests
run: make ci/test
# can't run this step inside of container because of tests specific
test-integration-nix:
name: Run integration tests on *Nix
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: 'src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod'
- name: Integration test
env:
GOPATH: ${{ github.workspace }}
run: make integration-test
prerelease:
name: Build binary for *Nix, create archives for *Nix, create packages for *Nix, upload all artifacts into GH Release assets
runs-on: ubuntu-latest
needs: [validate, test-nix, test-integration-nix]
steps:
- uses: actions/checkout@v4
- name: Pre release
run: make ci/prerelease
env:
GPG_MAIL: '[email protected]'
GPG_PASSPHRASE: ${{ secrets.OHAI_GPG_PASSPHRASE }}
GPG_PRIVATE_KEY_BASE64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} # base64 encoded
publish-to-s3:
name: Send release assets to S3
runs-on: ubuntu-latest
needs: [prerelease]
steps:
- name: Publish to S3 action
uses: newrelic/infrastructure-publish-action@v1
env:
AWS_S3_BUCKET_NAME: "nr-downloads-ohai-staging"
AWS_S3_LOCK_BUCKET_NAME: "onhost-ci-lock-staging"
with:
disable_lock: false
run_id: ${{ github.run_id }}
tag: ${{env.TAG}}
app_name: "nri-${{env.INTEGRATION}}"
repo_name: ${{ env.ORIGINAL_REPO_NAME }}
access_point_host: "staging"
schema: "custom"
schema_url: "https://raw.githubusercontent.com/newrelic/nri-docker/${{ env.TAG }}/build/s3-publish-schema.yml"
aws_region: "us-east-1"
aws_role_arn: ${{ secrets.OHAI_AWS_ROLE_ARN_STAGING }}
aws_role_session_name: ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_STAGING }}
aws_access_key_id: ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_STAGING }}
aws_secret_access_key: ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_STAGING }}
aws_s3_bucket_name: ${{ env.AWS_S3_BUCKET_NAME }}
# used for locking in case of concurrent releases
aws_s3_lock_bucket_name: ${{ env.AWS_S3_LOCK_BUCKET_NAME }}
# used for signing package stuff
gpg_passphrase: ${{ secrets.OHAI_GPG_PASSPHRASE }}
gpg_private_key_base64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }}
notify-failure:
if: ${{ always() && failure() }}
needs: [validate, test-nix, test-integration-nix, prerelease, publish-to-s3]
runs-on: ubuntu-latest
steps:
- name: Notify failure via Slack
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }}
slack-channel: ${{ secrets.COREINT_SLACK_CHANNEL }}
slack-text: "❌ `${{ env.ORIGINAL_REPO_NAME }}`: [prerelease pipeline failed](${{ github.server_url }}/${{ env.ORIGINAL_REPO_NAME }}/actions/runs/${{ github.run_id }})."