Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies and build environment (NEWRELIC-7248) #82

Merged
merged 3 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 21 additions & 37 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO_VERSION: '1.18'
INTEGRATION: "apache"
ORIGINAL_REPO_NAME: ${{ github.event.repository.full_name }}
REPO_FULL_NAME: ${{ github.event.repository.full_name }}
Expand All @@ -18,34 +17,29 @@ env:
jobs:
test-nix:
name: Run unit tests on *Nix
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- uses: actions/checkout@v3
- name: Unit tests
run: make ci/test

test-windows:
name: Run unit tests on Windows
runs-on: windows-2019
runs-on: windows-latest
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}}
working-directory: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: src/github.com/${{env.ORIGINAL_REPO_NAME}}
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{env.GO_VERSION}}
go-version-file: "src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod"
- name: Running unit tests
shell: pwsh
run: |
Expand All @@ -54,36 +48,31 @@ jobs:
# can't run this step inside of container because of tests specific
test-integration-nix:
name: Run integration tests on *Nix
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}}
working-directory: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1
path: src/github.com/${{env.ORIGINAL_REPO_NAME}}
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{env.GO_VERSION}}
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/Win, create archives for *Nix/Win, create packages for *Nix, upload all artifacts into GH Release assets
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [test-nix, test-windows, test-integration-nix]
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- uses: actions/checkout@v3
- name: Pre release
run: make ci/prerelease
env:
Expand All @@ -105,7 +94,7 @@ jobs:

package-win:
name: Create MSI & Upload into GH Release assets
runs-on: windows-2019
runs-on: windows-latest
needs: [prerelease]
env:
GOPATH: ${{ github.workspace }}
Expand All @@ -114,17 +103,17 @@ jobs:
PFX_PASSPHRASE: ${{ secrets.OHAI_PFX_PASSPHRASE }}
defaults:
run:
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}}
working-directory: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
strategy:
matrix:
goarch: [amd64,386]
# This integration has no previous msi packages
test-upgrade: [false]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: src/github.com/${{env.ORIGINAL_REPO_NAME}}
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
- name: Get PFX certificate from GH secrets
shell: bash
run: printf "%s" "$PFX_CERTIFICATE_BASE64" | base64 -d - > wincert.pfx
Expand Down Expand Up @@ -158,14 +147,9 @@ jobs:

publish-to-s3:
name: Send release assets to S3
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [package-win]
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Publish to S3 action
uses: newrelic/infrastructure-publish-action@v1
env:
Expand Down
47 changes: 17 additions & 30 deletions .github/workflows/push_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ env:
TAG: "v0.0.0" # needed for goreleaser windows builds
REPO_FULL_NAME: ${{ github.event.repository.full_name }}
ORIGINAL_REPO_NAME: "newrelic/nri-apache"
GO_VERSION: '1.18'
DOCKER_LOGIN_AVAILABLE: ${{ secrets.OHAI_DOCKER_HUB_ID }}

jobs:
static-analysis:
name: Run all static analysis checks
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: newrelic/newrelic-infra-checkers@v1
- name: Semgrep
uses: returntocorp/semgrep-action@v1
Expand All @@ -33,35 +32,29 @@ jobs:

test-nix:
name: Run unit tests on *Nix
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
if: ${{env.DOCKER_LOGIN_AVAILABLE}}
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- uses: actions/checkout@v3
- name: Unit tests
run: make ci/test

test-windows:
name: Run unit tests on Windows
runs-on: windows-2019
runs-on: windows-latest
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: src/github.com/${{env.ORIGINAL_REPO_NAME}}
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{env.GO_VERSION}}
go-version-file: "src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod"
- name: Running unit tests
shell: pwsh
run: |
Expand All @@ -70,35 +63,29 @@ jobs:
# can't run this step inside of container because of tests specific
test-integration-nix:
name: Run integration tests on *Nix
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}}
working-directory: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1
path: src/github.com/${{env.ORIGINAL_REPO_NAME}}
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }}
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{env.GO_VERSION}}
go-version-file: "src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod"
- name: Integration test
env:
GOPATH: ${{ github.workspace }}
run: make integration-test

test-build:
name: Test binary compilation for all platforms:arch
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
if: ${{env.DOCKER_LOGIN_AVAILABLE}}
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- uses: actions/checkout@v3
- name: Build all platforms:arch
run: make ci/build
7 changes: 1 addition & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ jobs:

publish-to-s3:
name: Send release assets to S3
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Publish to S3 action
uses: newrelic/infrastructure-publish-action@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repolinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
return data.data && data.data.default_branch === context.ref.split('/').slice(-1)[0]
- name: Checkout Self
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run Repolinter
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: newrelic/repolinter-action@v1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.10.0 (2023-03-08)
### Changed
- Upgrade Go to 1.19 and bump dependencies

## 1.9.1 (2022-06-27)
### Added
- Added support for more distributions:
Expand Down
7 changes: 5 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.18-buster
FROM golang:1.19-buster

ARG GH_VERSION='1.9.0'
ARG GH_VERSION='2.23.0'

RUN apt-get update \
&& apt-get -y install \
Expand All @@ -11,5 +11,8 @@ RUN apt-get update \
unzip \
zip

# Since the user does not match the owners of the repo "git rev-parse --is-inside-work-tree" fails and goreleaser does not populate projectName
# https://stackoverflow.com/questions/72978485/git-submodule-update-failed-with-fatal-detected-dubious-ownership-in-repositor
RUN git config --global --add safe.directory '*'
RUN curl -L https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.deb -o gh_${GH_VERSION}_linux_amd64.deb
RUN dpkg -i gh_${GH_VERSION}_linux_amd64.deb
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/newrelic/nri-apache

go 1.18
go 1.19

require (
github.com/newrelic/infra-integrations-sdk v3.7.3+incompatible
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 as builder
FROM golang:1.19 as builder
ARG CGO_ENABLED=0
WORKDIR /go/src/github.com/newrelic/nri-apache
COPY . .
Expand Down