|
1 | | -name: Create prerelease artifacts |
2 | | - |
| 1 | +name: Prerelease pipeline |
3 | 2 | on: |
4 | 3 | release: |
5 | 4 | types: |
6 | 5 | - prereleased |
7 | 6 | tags: |
8 | 7 | - 'v*' |
9 | 8 |
|
10 | | -env: |
11 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
12 | | - INTEGRATION: "mysql" |
13 | | - ORIGINAL_REPO_NAME: ${{ github.event.repository.full_name }} |
14 | | - REPO_FULL_NAME: ${{ github.event.repository.full_name }} |
15 | | - TAG: ${{ github.event.release.tag_name }} |
16 | | - |
17 | 9 | jobs: |
18 | | - snyk: |
19 | | - name: Run security checks via snyk |
20 | | - runs-on: ubuntu-22.04 |
21 | | - steps: |
22 | | - - uses: actions/checkout@v4 |
23 | | - - name: Login to DockerHub |
24 | | - uses: docker/login-action@v2 |
25 | | - with: |
26 | | - username: ${{ secrets.OHAI_DOCKER_HUB_ID }} |
27 | | - password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} |
28 | | - - name: Scan code for vulnerabilities |
29 | | - env: |
30 | | - SNYK_TOKEN: ${{ secrets.COREINT_SNYK_TOKEN }} |
31 | | - run: make ci/snyk-test |
32 | | - |
33 | | - test-nix: |
34 | | - name: Run unit tests on *Nix |
35 | | - runs-on: ubuntu-22.04 |
36 | | - steps: |
37 | | - - uses: actions/checkout@v4 |
38 | | - - name: Login to DockerHub |
39 | | - uses: docker/login-action@v2 |
40 | | - with: |
41 | | - username: ${{ secrets.OHAI_DOCKER_HUB_ID }} |
42 | | - password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} |
43 | | - - name: Unit tests |
44 | | - run: make ci/test |
45 | | - |
46 | | - test-windows: |
47 | | - name: Run unit tests on Windows |
48 | | - runs-on: windows-2022 |
49 | | - env: |
50 | | - GOPATH: ${{ github.workspace }} |
51 | | - defaults: |
52 | | - run: |
53 | | - working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}} |
54 | | - steps: |
55 | | - - name: Checkout |
56 | | - uses: actions/checkout@v4 |
57 | | - with: |
58 | | - path: src/github.com/${{env.ORIGINAL_REPO_NAME}} |
59 | | - - name: Install Go |
60 | | - uses: actions/setup-go@v4 |
61 | | - with: |
62 | | - go-version-file: "src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod" |
63 | | - - name: Running unit tests |
64 | | - shell: pwsh |
65 | | - run: | |
66 | | - .\build\windows\unit_tests.ps1 |
67 | | -
|
68 | | - # can't run this step inside of container because of tests specific |
69 | | - |
70 | | - test-integration-nix: |
71 | | - name: Run integration tests on *Nix |
72 | | - runs-on: ubuntu-22.04 |
73 | | - defaults: |
74 | | - run: |
75 | | - working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}} |
76 | | - steps: |
77 | | - - name: Check out code |
78 | | - uses: actions/checkout@v4 |
79 | | - with: |
80 | | - fetch-depth: 1 |
81 | | - path: src/github.com/${{env.ORIGINAL_REPO_NAME}} |
82 | | - - name: Install Go |
83 | | - uses: actions/setup-go@v4 |
84 | | - with: |
85 | | - go-version-file: "src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod" |
86 | | - - name: Login to DockerHub |
87 | | - uses: docker/login-action@v2 |
88 | | - with: |
89 | | - username: ${{ secrets.OHAI_DOCKER_HUB_ID }} |
90 | | - password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} |
91 | | - - name: Integration test |
92 | | - env: |
93 | | - GOPATH: ${{ github.workspace }} |
94 | | - run: make integration-test |
95 | | - |
96 | | - prerelease: |
97 | | - name: Build binary for *Nix/Win, create archives for *Nix/Win, create packages for *Nix, upload all artifacts into GH Release assets |
98 | | - runs-on: ubuntu-22.04 |
99 | | - needs: [snyk, test-nix, test-windows, test-integration-nix] |
100 | | - steps: |
101 | | - - uses: actions/checkout@v4 |
102 | | - - name: Login to DockerHub |
103 | | - uses: docker/login-action@v2 |
104 | | - with: |
105 | | - username: ${{ secrets.OHAI_DOCKER_HUB_ID }} |
106 | | - password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} |
107 | | - - name: Pre release |
108 | | - run: make ci/prerelease |
109 | | - env: |
110 | | - GPG_MAIL: 'infrastructure-eng@newrelic.com' |
111 | | - GPG_PASSPHRASE: ${{ secrets.OHAI_GPG_PASSPHRASE }} |
112 | | - GPG_PRIVATE_KEY_BASE64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} # base64 encoded |
113 | | - - name: Test package installability |
114 | | - uses: newrelic/integrations-pkg-test-action/linux@v1 |
115 | | - with: |
116 | | - tag: ${{ env.TAG }} |
117 | | - integration: nri-${{ env.INTEGRATION }} |
118 | | - |
119 | | - package-win: |
120 | | - name: Create MSI & Upload into GH Release assets |
121 | | - runs-on: windows-2022 |
122 | | - needs: [prerelease] |
123 | | - env: |
124 | | - GOPATH: ${{ github.workspace }} |
125 | | - PFX_CERTIFICATE_BASE64: ${{ secrets.OHAI_PFX_CERTIFICATE_BASE64 }} # base64 encoded |
126 | | - PFX_PASSPHRASE: ${{ secrets.OHAI_PFX_PASSPHRASE }} |
127 | | - PFX_CERTIFICATE_DESCRIPTION: 'New Relic' |
128 | | - defaults: |
129 | | - run: |
130 | | - working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}} |
131 | | - strategy: |
132 | | - matrix: |
133 | | - goarch: [amd64,386] |
134 | | - test-upgrade: [true,false] |
135 | | - steps: |
136 | | - - name: Checkout |
137 | | - uses: actions/checkout@v4 |
138 | | - with: |
139 | | - path: src/github.com/${{env.ORIGINAL_REPO_NAME}} |
140 | | - - name: Get PFX certificate from GH secrets |
141 | | - shell: bash |
142 | | - run: printf "%s" "$PFX_CERTIFICATE_BASE64" | base64 -d - > wincert.pfx |
143 | | - - name: Download zip from GH Release assets and extract .exe |
144 | | - shell: pwsh |
145 | | - run: | |
146 | | - build\windows\download_zip_extract_exe.ps1 "$env:INTEGRATION" ${{ matrix.goarch }} "$env:TAG" "$env:REPO_FULL_NAME" |
147 | | - - name: Create MSI |
148 | | - shell: pwsh |
149 | | - run: | |
150 | | - build\windows\package_msi.ps1 -integration "$env:INTEGRATION" -arch ${{ matrix.goarch }} -tag "$env:TAG" -pfx_passphrase "$env:PFX_PASSPHRASE" -pfx_certificate_description "$env:PFX_CERTIFICATE_DESCRIPTION" |
151 | | - - name: Test win packages installation |
152 | | - uses: newrelic/integrations-pkg-test-action/windows@v1 |
153 | | - with: |
154 | | - tag: ${{ env.TAG }} |
155 | | - integration: nri-${{ env.INTEGRATION }} |
156 | | - arch: ${{ matrix.goarch }} |
157 | | - upgrade: ${{ matrix.test-upgrade }} |
158 | | - - name: Upload MSI to GH |
159 | | - # To avoid upload packages twice |
160 | | - if: startsWith(matrix.test-upgrade, 'false') |
161 | | - shell: bash |
162 | | - run: | |
163 | | - build/windows/upload_msi.sh ${INTEGRATION} ${{ matrix.goarch }} ${TAG} |
164 | | -
|
165 | | - publish-to-s3: |
166 | | - name: Send release assets to S3 |
167 | | - runs-on: ubuntu-22.04 |
168 | | - needs: [package-win] |
169 | | - steps: |
170 | | - - name: Login to DockerHub |
171 | | - uses: docker/login-action@v2 |
172 | | - with: |
173 | | - username: ${{ secrets.OHAI_DOCKER_HUB_ID }} |
174 | | - password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} |
175 | | - - name: Publish to S3 action |
176 | | - uses: newrelic/infrastructure-publish-action@v1 |
177 | | - env: |
178 | | - AWS_S3_BUCKET_NAME: "nr-downloads-ohai-staging" |
179 | | - AWS_S3_LOCK_BUCKET_NAME: "onhost-ci-lock-staging" |
180 | | - with: |
181 | | - disable_lock: false |
182 | | - run_id: ${{ github.run_id }} |
183 | | - tag: ${{env.TAG}} |
184 | | - app_name: "nri-${{env.INTEGRATION}}" |
185 | | - repo_name: ${{ env.ORIGINAL_REPO_NAME }} |
186 | | - access_point_host: "staging" |
187 | | - # 'ohi' is for integrations |
188 | | - schema: "ohi" |
189 | | - aws_region: "us-east-1" |
190 | | - aws_role_arn: ${{ secrets.OHAI_AWS_ROLE_ARN_STAGING }} |
191 | | - aws_role_session_name: ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_STAGING }} |
192 | | - aws_access_key_id: ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_STAGING }} |
193 | | - aws_secret_access_key: ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_STAGING }} |
194 | | - aws_s3_bucket_name: ${{ env.AWS_S3_BUCKET_NAME }} |
195 | | - # used for locking in case of concurrent releases |
196 | | - aws_s3_lock_bucket_name: ${{ env.AWS_S3_LOCK_BUCKET_NAME }} |
197 | | - # used for signing package stuff |
198 | | - gpg_passphrase: ${{ secrets.OHAI_GPG_PASSPHRASE }} |
199 | | - gpg_private_key_base64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} |
200 | | - - name: Test uploaded package installability |
201 | | - uses: newrelic/integrations-pkg-test-action/linux@v1 |
202 | | - with: |
203 | | - tag: ${{ env.TAG }} |
204 | | - integration: nri-${{ env.INTEGRATION }} |
205 | | - packageLocation: repo |
206 | | - stagingRepo: true |
207 | | - upgrade: false |
208 | | - |
209 | | - |
210 | | - notify-failure: |
211 | | - if: ${{ always() && failure() }} |
212 | | - needs: [snyk, test-nix, test-windows, test-integration-nix, prerelease, package-win, publish-to-s3] |
213 | | - runs-on: ubuntu-latest |
214 | | - steps: |
215 | | - - name: Notify failure via Slack |
216 | | - uses: archive/github-actions-slack@master |
217 | | - with: |
218 | | - slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }} |
219 | | - slack-channel: ${{ secrets.COREINT_SLACK_CHANNEL }} |
220 | | - slack-text: "❌ `${{ env.ORIGINAL_REPO_NAME }}`: [prerelease pipeline failed](${{ github.server_url }}/${{ env.ORIGINAL_REPO_NAME }}/actions/runs/${{ github.run_id }})." |
| 10 | + pre-release: |
| 11 | + uses: newrelic/coreint-automation/.github/workflows/reusable_pre_release.yaml@v2 |
| 12 | + with: |
| 13 | + tag: ${{ github.event.release.tag_name }} |
| 14 | + integration: mysql |
| 15 | + secrets: inherit |
0 commit comments