Skip to content

Commit ce8c16c

Browse files
committed
fix(build): ignore 403s when publishing and just continue
The most common publishing failure we currently see is a 403 where the target repo indicates that the artifact in question is already present in the repo. We don't know how that happens, but ignoring the error in such a case is perfectly fine as the artifact is actually already present. This commit adds the `--continue` Gradle flag to the publish call to ignore the 403s. To avoid trying to upload something that's completely broken but would pass the build due to `--continue`, the `build` call has been put into a separate workflow step and therefore Gradle skip-lint
1 parent 5409905 commit ce8c16c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,26 @@ jobs:
2828
uses: gradle/gradle-build-action@v2
2929
- name: Use tag as version
3030
run: echo "${GITHUB_REF#refs/*/}" > version.txt
31-
- name: Build and Publish Artifacts
31+
# Perform the build in a separate call to avoid trying to publish
32+
# something where the build already failed partially. This could happen
33+
# due to the use of the --continue flag in the publish step.
34+
- name: Build
35+
run: >-
36+
./gradlew --build-cache build
37+
--info
38+
-PciBuild=true
39+
- name: Publish
3240
# We run gradle with --info to debug the ongoing random publishing
3341
# issues. Gradle would log upload retries on info level:
3442
# https://github.com/gradle/gradle/blob/2e843f089f969940e505e69eb0742ed4fbf67993/platforms/software/dependency-management/src/main/java/org/gradle/api/internal/artifacts/repositories/transport/NetworkOperationBackOffAndRetry.java#L64
3543
# Maybe retries are the source of our duplicate publication attempts.
44+
#
45+
# We use --continue to work around the commonly seen 403 issues.
46+
# Usually, the artifact that cannot be uploaded is strangely already
47+
# in the repo. As the result, by ignoring the exception, we should end
48+
# up with a working release in most cases.
3649
run: >-
37-
./gradlew --build-cache build publish
50+
./gradlew --build-cache publish
3851
--info
3952
-PciBuild=true
4053
-Partifacts.itemis.cloud.user=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_USER }}

0 commit comments

Comments
 (0)