-
Notifications
You must be signed in to change notification settings - Fork 42
133 lines (113 loc) · 4.79 KB
/
pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: New Relic Fluent Bit Output Plugin - Pull Request
on: [pull_request]
jobs:
unit-tests:
name: CI - Tests and Build
runs-on: ubuntu-20.04
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
with:
go-version: '1.20.7'
id: go
- name: Check go version
run: go version
- name: Checkout code
uses: actions/checkout@v2
- 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/publish-unit-test-result-action@v2.6.2
if: always()
with:
files: test-results.xml
- name: Build project
run: make linux/amd64
docker-ci:
name: CI - Docker image build (${{ matrix.name }})
runs-on: ubuntu-20.04
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
include:
- name: standard-image
dockerfile: Dockerfile
platforms: linux/amd64, linux/arm64, linux/arm/v7
- name: debug-image
dockerfile: Dockerfile_debug
# Fluent Bit debug image only available for amd64 architecture
platforms: linux/amd64
- name: firelens-image
dockerfile: Dockerfile_firelens
# Firelens image only available for amd64 and arm64 architectures
platforms: linux/amd64, linux/arm64
steps:
- name: Checkout code
uses: actions/checkout@v2
# The QEMU will include more platforms such as arm64 to docker buildx builder
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# 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
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
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
with:
context: ./
file: ./${{ matrix.dockerfile }}
push: true
tags: localhost:5000/fb-output-plugin-${{ matrix.name }}
builder: ${{ steps.buildx.outputs.name }}
platforms: ${{ matrix.platforms }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Inspect generated Docker image (${{ matrix.name }})
run: docker buildx imagetools inspect localhost:5000/fb-output-plugin-${{ matrix.name }}
- name: Test Docker image (${{ matrix.name }})
run: bash test.sh localhost:5000/fb-output-plugin-${{ matrix.name }}
docker-windows-ci:
name: CI - Docker image for ${{ matrix.name }}
# We aim to support https://kubernetes.io/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#windows-os-version-support
# More info: https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#choose_your_windows_server_node_image
# Tag reference: https://hub.docker.com/_/microsoft-windows-servercore
# Compatibility matrix: https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility
strategy:
matrix:
include:
- name: Windows Server 2019 (LTSC)
windowsImageTag: ltsc2019-amd64
imageTagSuffix: windows-ltsc-2019
runsOn: windows-2019
- name: Windows Server 2022 (LTSC)
windowsImageTag: ltsc2022-amd64
imageTagSuffix: windows-ltsc-2022
runsOn: windows-2022
runs-on: ${{ matrix.runsOn }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build container for ${{ matrix.name }}
env:
DOCKERHUB_REPOSITORY: newrelic/newrelic-fluentbit-output
IMAGE_TAG: development-${{ matrix.imageTagSuffix }}
run: |
docker build -f Dockerfile.windows -t ${{ env.DOCKERHUB_REPOSITORY }}:${{ env.IMAGE_TAG }} --build-arg WINDOWS_VERSION=${{ matrix.windowsImageTag }} .