Skip to content

Modified github workflows #187

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
81 changes: 22 additions & 59 deletions .github/workflows/merge-to-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
steps:
# We can't go past 1.20.X until this issue is solved: https://github.com/golang/go/issues/62130#issuecomment-1687335898
- name: Set up Go 1.20.7
uses: actions/setup-go@v4
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: '1.20.7'

- name: Check go version
run: go version

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Run unit tests
run: go test ./...
Expand Down Expand Up @@ -55,29 +55,29 @@ jobs:

# The QEMU will include more platforms such as arm64 to docker buildx builder
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3

# The Docker Buildx builder will be used later to leverage from the cache while building the image
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3

# Cache to be used by Docker Buildx
- name: Set up Docker Buildx's cache
uses: actions/cache@v2
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-

- name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and Publish Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
env:
DOCKERHUB_REPOSITORY: newrelic/newrelic-fluentbit-output
IMAGE_TAG: ${{ env.VERSION }}
Expand All @@ -97,7 +97,7 @@ jobs:
run: docker buildx imagetools inspect newrelic/newrelic-fluentbit-output:${{ env.VERSION }}

- name: Build and Publish Docker debug image
uses: docker/build-push-action@v2
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
env:
DOCKERHUB_REPOSITORY: newrelic/newrelic-fluentbit-output
IMAGE_TAG: ${{ env.VERSION }}-debug
Expand All @@ -116,18 +116,18 @@ jobs:
run: docker buildx imagetools inspect newrelic/newrelic-fluentbit-output:${{ env.VERSION }}-debug

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2

- name: Build and Publish Docker image for Firelens
uses: docker/build-push-action@v2
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
env:
ECR_REGISTRY: 533243300146.dkr.ecr.us-east-2.amazonaws.com
ECR_REPOSITORY: newrelic/logging-firelens-fluentbit
Expand All @@ -150,7 +150,7 @@ jobs:

- name: Create Release
id: create_release
uses: actions/create-release@v1
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -159,55 +159,18 @@ jobs:
draft: false
prerelease: false

- name: Include linux-amd64 artifact in release
uses: actions/upload-release-asset@v1
- name: Upload Release Assets
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./out_newrelic-linux-amd64-${{ env.VERSION }}.so
asset_name: out_newrelic-linux-amd64-${{ env.VERSION }}.so
asset_content_type: application/octet-stream

- name: Include windows-amd64 artifact in release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./out_newrelic-windows-amd64-${{ env.VERSION }}.dll
asset_name: out_newrelic-windows-amd64-${{ env.VERSION }}.dll
asset_content_type: application/octet-stream

- name: Include windows-386 artifact in release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./out_newrelic-windows-386-${{ env.VERSION }}.dll
asset_name: out_newrelic-windows-386-${{ env.VERSION }}.dll
asset_content_type: application/octet-stream

- name: Include linux-arm64 artifact in release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./out_newrelic-linux-arm64-${{ env.VERSION }}.so
asset_name: out_newrelic-linux-arm64-${{ env.VERSION }}.so
asset_content_type: application/octet-stream

- name: Include linux-arm artifact in release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./out_newrelic-linux-arm-${{ env.VERSION }}.so
asset_name: out_newrelic-linux-arm-${{ env.VERSION }}.so
asset_content_type: application/octet-stream
files: |
./out_newrelic-linux-amd64-${{ env.VERSION }}.so
./out_newrelic-windows-amd64-${{ env.VERSION }}.dll
./out_newrelic-windows-386-${{ env.VERSION }}.dll
./out_newrelic-linux-arm64-${{ env.VERSION }}.so
./out_newrelic-linux-arm-${{ env.VERSION }}.so

windows-docker-images:
name: ${{ matrix.name }} Docker image generation and publishing
Expand All @@ -231,7 +194,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Determine new plugin version
run: |
Expand All @@ -241,7 +204,7 @@ jobs:
Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$env:VERSION"

- name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
# We can't go past 1.20.X until this issue is solved: https://github.com/golang/go/issues/62130#issuecomment-1687335898
- name: Set up Go 1.20.7
uses: actions/setup-go@v4
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
with:
go-version: '1.20.7'
id: go
Expand All @@ -19,15 +19,15 @@ jobs:
run: go version

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Run unit tests
run: |
go install -v github.com/jstemmer/go-junit-report@latest
go test -v ./... 2>&1 | go-junit-report -set-exit-code=1 > test-results.xml

- name: Publish Unit Test Results
uses: EnricoMi/[email protected]
uses: EnricoMi/publish-unit-test-result-action@39ee91a16bb587a6c2b4791d4954cf5299736efd # v2.6.2
if: always()
with:
files: test-results.xml
Expand Down Expand Up @@ -59,31 +59,31 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

# The QEMU will include more platforms such as arm64 to docker buildx builder
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3

# The Docker Buildx builder will be used later to leverage from the cache while building the image
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
with:
# This option is required to avoid this problem https://github.com/docker/for-mac/issues/3611#issuecomment-479507361
# We need this option to be able to push to the local registry service used by the integration tests.
driver-opts: network=host

# Cache to be used by Docker Buildx
- name: Set up Docker Buildx's cache
uses: actions/cache@v2
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-

- name: Build Docker image (${{ matrix.name }})
uses: docker/build-push-action@v2
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
with:
context: ./
file: ./${{ matrix.dockerfile }}
Expand All @@ -100,7 +100,7 @@ jobs:
TRIVY_NON_SSL: true
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
# Versions 0.26.0 and above are causing an issue where the image can't be fetched because the image name is not being resolved.
uses: aquasecurity/[email protected]
uses: aquasecurity/trivy-action@f781cce5aab226378ee181d764ab90ea0be3cdd8 # 0.25.0
with:
image-ref: registry:5000/fb-output-plugin-${{ matrix.name }}
format: table
Expand All @@ -113,7 +113,7 @@ jobs:
TRIVY_NON_SSL: true
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db
uses: aquasecurity/[email protected]
uses: aquasecurity/trivy-action@f781cce5aab226378ee181d764ab90ea0be3cdd8 # 0.25.0
with:
image-ref: registry:5000/fb-output-plugin-${{ matrix.name }}
format: table
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Build container for ${{ matrix.name }}
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/repolinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
steps:
- name: Test Default Branch
id: default-branch
uses: actions/github-script@v2
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const data = await github.repos.get(context.repo)
const data = await github.rest.repos.get(context.repo)
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Run Repolinter
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: newrelic/repolinter-action@v1
uses: newrelic/repolinter-action@3f4448f855c351e9695b24524a4111c7847b84cb # v1
with:
config_url: https://raw.githubusercontent.com/newrelic/.github/main/repolinter-rulesets/community-plus.yml
output_type: issue
Loading