Skip to content

chore: Bump nri-ibmmq exporter version (#229) #242

chore: Bump nri-ibmmq exporter version (#229)

chore: Bump nri-ibmmq exporter version (#229) #242

Workflow file for this run

# This Workflow creates a pre-release of the exporter that has been modified.
on:
push:
branches:
- main
permissions:
contents: write
env:
GPG_MAIL: '[email protected]'
OHAI_PFX_CERTIFICATE_BASE64: ${{ secrets.OHAI_PFX_CERTIFICATE_BASE64 }} # base64 encoded
OHAI_PFX_PASSPHRASE: ${{ secrets.OHAI_PFX_PASSPHRASE }}
GORELEASER_VERSION: 'v1.13.1'
name: Create Pre-release
jobs:
check_exporter_preconditions:
name: Test exporter e2e and output exporter variables
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: nri-config-generator/go.mod
- name: Check if exporters have been modified
id: check
# Running shouldDoRelease we check if any exporter.yml has been modified, if so we set CREATE_RELEASE to true setting the variable EXPORTER_PATH
# That variable is used by the following step and jobs
run : |
source ./scripts/common_functions.sh
shouldDoRelease
loadVariables $EXPORTER_PATH
setStepOutput
- name: Install goreleaser
if: ${{ steps.check.outputs.CREATE_RELEASE == 'true'}}
uses: goreleaser/goreleaser-action@v4
with:
version: ${{ env.GORELEASER_VERSION }}
install-only: true
- name: Compile exporter
if: ${{ steps.check.outputs.CREATE_RELEASE == 'true'}}
run : |
make build-${{ steps.check.outputs.NAME }}
- name: e2e-test
if: ${{ steps.check.outputs.CREATE_RELEASE == 'true'}}
uses: newrelic/newrelic-integration-e2e-action@v1
with:
spec_path: exporters/${{ steps.check.outputs.NAME }}/e2e/e2e_spec.yml
account_id: ${{ secrets.COREINT_E2E_ACCOUNT_ID }}
api_key: ${{ secrets.COREINT_E2E_API_KEY }}
license_key: ${{ secrets.COREINT_E2E_LICENSE_KEY }}
outputs:
CREATE_RELEASE: ${{ steps.check.outputs.CREATE_RELEASE }}
EXPORTER_PATH: ${{ steps.check.outputs.EXPORTER_PATH }}
PACKAGE_LINUX: ${{ steps.check.outputs.PACKAGE_LINUX }}
PACKAGE_WINDOWS: ${{ steps.check.outputs.PACKAGE_WINDOWS }}
INTEGRATION_NAME: ${{ steps.check.outputs.NAME }}
INTEGRATION_VERSION: ${{ steps.check.outputs.VERSION }}
RELEASE_TAG: ${{ steps.check.outputs.PACKAGE_NAME }}-${{ steps.check.outputs.VERSION }}
EXPORTER_REPO_URL: ${{ steps.check.outputs.EXPORTER_REPO_URL }}
EXPORTER_HEAD: ${{ steps.check.outputs.EXPORTER_HEAD }}
EXPORTER_CHANGELOG: ${{ steps.check.outputs.EXPORTER_CHANGELOG }}
build_linux_artifacts:
name: Build Linux artifacts and packages
runs-on: ubuntu-latest
needs: [check_exporter_preconditions]
if: ${{ needs.check_exporter_preconditions.outputs.CREATE_RELEASE == 'true' && needs.check_exporter_preconditions.outputs.PACKAGE_LINUX == 'true'}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: nri-config-generator/go.mod
- name: Install goreleaser
uses: goreleaser/goreleaser-action@v4
with:
version: ${{ env.GORELEASER_VERSION }}
install-only: true
- name: Install dependencies
run: |
sudo apt-get install rpm ruby ruby-dev rubygems build-essential rpm gnupg2 gpg-agent debsigs
sudo gem install --no-document fpm
- name: Load variables
id: vars
run : |
export GOPATH=$(go env GOPATH)
export EXPORTER_PATH=${{ needs.check_exporter_preconditions.outputs.EXPORTER_PATH }}
source ./scripts/common_functions.sh
loadVariables $EXPORTER_PATH
setStepOutput
- name: Package linux
id: package
env:
GPG_PASSPHRASE: ${{ secrets.OHAI_GPG_PASSPHRASE }}
GPG_PRIVATE_KEY_BASE64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} # base64 encoded
run : |
make package-${{ steps.vars.outputs.NAME }}
- name: Test package installability
uses: newrelic/integrations-pkg-test-action/linux@v1
with:
tag: ${{ steps.vars.outputs.VERSION }}
integration: nri-${{ steps.vars.outputs.NAME }}
upgrade: false
pkgDir: ./exporters/${{ steps.vars.outputs.NAME }}/target/packages/
- name: Upload assets to be released
uses: actions/upload-artifact@v3
with:
name: linux-artifacts
retention-days: 1
path: |
./exporters/${{ steps.vars.outputs.NAME }}/target/packages/*_${{ steps.vars.outputs.VERSION }}-1_*.deb
./exporters/${{ steps.vars.outputs.NAME }}/target/packages/*_linux_${{ steps.vars.outputs.VERSION }}_*.tar.gz
./exporters/${{ steps.vars.outputs.NAME }}/target/packages/*-${{ steps.vars.outputs.VERSION }}-1.*.rpm
build_windows_artifacts:
name: Build Windows artifacts and packages
runs-on: windows-latest
needs: [check_exporter_preconditions]
if: ${{ needs.check_exporter_preconditions.outputs.CREATE_RELEASE == 'true' && needs.check_exporter_preconditions.outputs.PACKAGE_WINDOWS == 'true' }}
env:
GOPATH: ${{ github.workspace }}
GOOS: windows
defaults:
run:
working-directory: src/repo
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src/repo
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: src/repo/nri-config-generator/go.mod
- name: Install goreleaser
uses: goreleaser/goreleaser-action@v4
with:
version: ${{ env.GORELEASER_VERSION }}
install-only: true
- name: Get PFX certificate from GH secrets
shell: bash
run: printf "%s" "$OHAI_PFX_CERTIFICATE_BASE64" | base64 -d - > mycert.pfx
- name: Load Variables
id: vars
shell: bash
run: |
choco install yq
export EXPORTER_PATH=${{ needs.check_exporter_preconditions.outputs.EXPORTER_PATH }}
source ./scripts/common_functions.sh
loadVariables $EXPORTER_PATH
setStepOutput
- name: Build windows binary
id: package
shell: bash
run : |
make package-${{ steps.vars.outputs.NAME }}
- name: Test win packages installation
uses: newrelic/integrations-pkg-test-action/windows@v1
with:
tag: ${{ steps.vars.outputs.VERSION }}
integration: nri-${{ steps.vars.outputs.NAME }}
arch: amd64
pkgDir: ${{ github.workspace }}\src\repo\exporters\${{ steps.vars.outputs.NAME }}\target\packages
pkgName: ${{ steps.vars.outputs.PACKAGE_NAME }}-amd64.${{ steps.vars.outputs.VERSION }}.msi
upgrade: false
- name: Upload assets to be released
uses: actions/upload-artifact@v3
with:
name: windows-artifacts
retention-days: 1
path: |
${{ github.workspace }}\src\repo\exporters\${{ steps.vars.outputs.NAME }}\target\packages\*.msi
${{ github.workspace }}\src\repo\exporters\${{ steps.vars.outputs.NAME }}\target\packages\*.zip
create_publish_schema:
name: Create the publish schema
runs-on: ubuntu-latest
if: ${{ needs.check_exporter_preconditions.outputs.CREATE_RELEASE == 'true' }}
needs: [ check_exporter_preconditions ]
steps:
- uses: actions/checkout@v4
- run: make create-publish-schema-${{ needs.check_exporter_preconditions.outputs.INTEGRATION_NAME }}
- uses: actions/upload-artifact@v3
with:
name: publish-schema
retention-days: 1
path: |
scripts/pkg/s3-publish-schema-tmp.yml
create_prerelease_and_upload_packages:
name: Create pre-release and upload packages to staging repositories
runs-on: ubuntu-latest
# Using 'always() && !( failure() )' the job is executed unless any of the needed jobs fails (even if some are skipped)
if: ${{ always() && !( failure() ) && needs.check_exporter_preconditions.outputs.CREATE_RELEASE == 'true' }}
needs: [ check_exporter_preconditions, build_linux_artifacts, build_windows_artifacts, create_publish_schema ]
steps:
- name: Downloading Linux artifacts
if: ${{ needs.check_exporter_preconditions.outputs.PACKAGE_LINUX == 'true' }}
uses: actions/download-artifact@v3
with:
name: linux-artifacts
path: packages
- name: Downloading Windows artifacts
if: ${{ needs.check_exporter_preconditions.outputs.PACKAGE_WINDOWS == 'true' }}
uses: actions/download-artifact@v3
with:
name: windows-artifacts
path: packages
- name: Downloading Publish schema
uses: actions/download-artifact@v3
with:
name: publish-schema
path: .
- name: Create Release for the exporter modified
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.check_exporter_preconditions.outputs.RELEASE_TAG }}
name: ${{ needs.check_exporter_preconditions.outputs.INTEGRATION_NAME }} ${{ needs.check_exporter_preconditions.outputs.INTEGRATION_VERSION }}
prerelease: true
body: |
Changes in ${{ needs.check_exporter_preconditions.outputs.PACKAGE_NAME }} version ${{ needs.check_exporter_preconditions.outputs.VERSION }}
- Exporter repository URL: ${{ needs.check_exporter_preconditions.outputs.EXPORTER_REPO_URL }}
- Commit or Tag of the exporter packaged: ${{ needs.check_exporter_preconditions.outputs.EXPORTER_HEAD }}
- CHANGELOG: ${{ needs.check_exporter_preconditions.outputs.EXPORTER_CHANGELOG }}
files: |
packages/*
- name: Publish to S3 action (staging)
uses: newrelic/infrastructure-publish-action@v1
env:
AWS_S3_BUCKET_NAME: "nr-downloads-ohai-staging"
AWS_S3_LOCK_BUCKET_NAME: "onhost-ci-lock-staging"
ACCESS_POINT_HOST: "staging"
with:
disable_lock: false
run_id: ${{ github.run_id }}
tag: ${{ needs.check_exporter_preconditions.outputs.RELEASE_TAG }}
app_version: ${{ needs.check_exporter_preconditions.outputs.INTEGRATION_VERSION }}
app_name: nri-${{ needs.check_exporter_preconditions.outputs.INTEGRATION_NAME }}
repo_name: ${{ github.event.repository.full_name }}
schema: "custom-local"
schema_path: ./s3-publish-schema-tmp.yml
access_point_host: ${{ env.ACCESS_POINT_HOST }}
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 }}
aws_s3_lock_bucket_name: ${{ env.AWS_S3_LOCK_BUCKET_NAME }}
gpg_passphrase: ${{ secrets.OHAI_GPG_PASSPHRASE }}
gpg_private_key_base64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }}
- name: Test package installability (staging)
uses: newrelic/integrations-pkg-test-action/linux@v1
with:
tag: ${{ needs.check_exporter_preconditions.outputs.INTEGRATION_VERSION }}
integration: nri-${{ needs.check_exporter_preconditions.outputs.INTEGRATION_NAME }}
packageLocation: repo
stagingRepo: true
upgrade: false