Fix failure logic for publishing packages. (#14720)
- Don’t fail jobs if publishing to PackageCloud fails (it’s expected to fail in a number of circumstances). - Do fail jobs if we can’t publish to our own hosting infrastructure.
Austin S. Hemmelgarn committed
Mar 28, 2023 at 10:05 UTC
b19d9076d883167c9df572dc88b05c07abafa516
2 files changed
+36
-38
.github/workflows/packaging.yml
+15
-16
@@ -193,10 +193,23 @@ jobs:
193
-e VERSION=${{ needs.version-check.outputs.version }} -e DISTRO_VERSION=${{ matrix.version }} \
194
--platform=${{ matrix.platform }} -v "$PWD":/netdata ${{ matrix.base_image }} \
195
/netdata/.github/scripts/pkg-test.sh
196
+ - name: Upload to PackageCloud
197
+ id: upload
198
+ if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
199
+ continue-on-error: true
200
+ shell: bash
201
+ env:
202
+ PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
203
+ run: |
204
+ printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})"
205
+ for pkgfile in artifacts/*.${{ matrix.format }} ; do
206
+ .github/scripts/package_cloud_wrapper.sh yank ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} \
207
+ "$(basename "${pkgfile}")" || true
208
+ .github/scripts/package_cloud_wrapper.sh push ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} "${pkgfile}"
209
+ done
210
- name: SSH setup
211
id: ssh-setup
212
if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
199
- continue-on-error: true
213
uses: shimataro/ssh-key-action@v2
214
with:
215
key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }}
@@ -204,7 +217,6 @@ jobs:
217
known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }}
218
- name: Upload to packages.netdata.cloud
219
id: package-upload
207
- continue-on-error: true
220
if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
221
run: |
222
.github/scripts/package-upload.sh \
@@ -212,19 +224,6 @@ jobs:
224
${{ matrix.arch }} \
225
${{ matrix.format }} \
226
${{ needs.version-check.outputs.repo }}
215
- - name: Upload to PackageCloud
216
- id: upload
217
- if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
218
- shell: bash
219
- env:
220
- PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
221
- run: |
222
- printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})"
223
- for pkgfile in artifacts/*.${{ matrix.format }} ; do
224
- .github/scripts/package_cloud_wrapper.sh yank ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} \
225
- "$(basename "${pkgfile}")" || true
226
- .github/scripts/package_cloud_wrapper.sh push ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} "${pkgfile}"
227
- done
227
- name: Failure Notification
228
uses: rtCamp/action-slack-notify@v2
229
env:
@@ -240,9 +239,9 @@ jobs:
239
Fetch images: ${{ steps.fetch-images.outcome }}
240
Build: ${{ steps.build.outcome }}
241
Test: ${{ steps.test.outcome }}
242
+ Publish to PackageCloud: ${{ steps.upload.outcome }}
243
Import SSH Key: ${{ steps.ssh-setup.outcome }}
244
Publish to packages.netdata.cloud: ${{ steps.package-upload.outcome }}
245
- Publish to PackageCloud: ${{ steps.upload.outcome }}
245
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
246
if: >-
247
${{
.github/workflows/repoconfig-packages.yml
+21
-22
@@ -94,10 +94,29 @@ jobs:
94
docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --platform ${{ matrix.platform }} \
95
-v "$PWD":/netdata ${{ matrix.base_image }} \
96
/netdata/packaging/repoconfig/build-${{ matrix.format }}.sh
97
+ - name: Upload Packages
98
+ id: publish
99
+ if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata'
100
+ continue-on-error: true
101
+ shell: bash
102
+ env:
103
+ PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
104
+ run: |
105
+ printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})"
106
+ for pkgfile in artifacts/*.${{ matrix.format }} ; do
107
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" \
108
+ "$(basename "${pkgfile}")" || true
109
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" "${pkgfile}"
110
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" \
111
+ "$(basename "${pkgfile}")" || true
112
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" "${pkgfile}"
113
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" \
114
+ "$(basename "${pkgfile}")" || true
115
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" "${pkgfile}"
116
+ done
117
- name: SSH setup
118
id: ssh-setup
119
if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata'
100
- continue-on-error: true
120
uses: shimataro/ssh-key-action@v2
121
with:
122
key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }}
@@ -105,7 +124,6 @@ jobs:
124
known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }}
125
- name: Upload to packages.netdata.cloud
126
id: package-upload
108
- continue-on-error: true
127
if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata'
128
run: |
129
for arch in ${{ matrix.arches }}; do
@@ -117,25 +135,6 @@ jobs:
135
netdata/netdata${suffix}
136
done
137
done
120
- - name: Upload Packages
121
- id: publish
122
- if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata'
123
- shell: bash
124
- env:
125
- PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
126
- run: |
127
- printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})"
128
- for pkgfile in artifacts/*.${{ matrix.format }} ; do
129
- .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" \
130
- "$(basename "${pkgfile}")" || true
131
- .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" "${pkgfile}"
132
- .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" \
133
- "$(basename "${pkgfile}")" || true
134
- .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" "${pkgfile}"
135
- .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" \
136
- "$(basename "${pkgfile}")" || true
137
- .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" "${pkgfile}"
138
- done
138
- name: Failure Notification
139
if: ${{ failure() && github.repository == 'netdata/netdata' }}
140
uses: rtCamp/action-slack-notify@v2
@@ -150,7 +149,7 @@ jobs:
149
Checkout: ${{ steps.checkout.outcome }}
150
Fetch images: ${{ steps.fetch-images.outcome }}
151
Build: ${{ steps.build.outcome }}
152
+ Publish to PackageCloud: ${{ steps.publish.outcome }}
153
Import SSH Key: ${{ steps.ssh-setup.outcome }}
154
Publish to packages.netdata.cloud: ${{ steps.package-upload.outcome }}
155
- Publish to PackageCloud: ${{ steps.publish.outcome }}
155
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}