Skip to content

Commit 3bec521

Browse files
chore: Fix re-run CI workflows (#1219)
1 parent ba726b5 commit 3bec521

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

codebuild/ci/release-ci.yml

+13-11
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,18 @@ phases:
2727
build:
2828
commands:
2929
- VERSION_HASH="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-$CODEBUILD_RESOLVED_SOURCE_VERSION"
30-
# See https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
30+
31+
# Remove any old artifacts with the same commit ID. This allows CI to run more than once for the same commit
32+
- |
33+
aws codeartifact delete-package-versions --domain $DOMAIN \
34+
--repository $REPOSITORY \
35+
--format maven \
36+
--namespace $NAMESPACE \
37+
--package $PACKAGE \
38+
--versions $VERSION_HASH \
39+
--region $REGION;
40+
41+
# See https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
3142
- echo "Setting version in POM to $VERSION_HASH"
3243
- mvn versions:set -DnewVersion="$VERSION_HASH" --no-transfer-progress
3344
- echo "Version is now $(grep version pom.xml | head -n 1 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p')"
@@ -49,14 +60,5 @@ phases:
4960
- |
5061
if expr ${CODEBUILD_BUILD_SUCCEEDING} != 1; then
5162
echo "An error occured while building and uploading $REPOSITORY."
52-
echo "Did a previous build already upload $VERSION_HASH to $REPOSITORY?"
53-
echo "Try deleting $VERSION_HASH from $REPOSITORY and restart"
54-
echo "Delete Package Version Command \n
55-
aws codeartifact delete-package-versions --domain $DOMAIN \
56-
--repository $REPOSITORY \
57-
--format maven \
58-
--namespace $NAMESPACE \
59-
--package $PACKAGE \
60-
--versions $VERSION_HASH \
61-
--region $REGION";
63+
echo "Check logs above for error details."
6264
fi

0 commit comments

Comments
 (0)