Conversation
- Extracted bash logic into standalone prevent-overwrites.sh script - Simplified action.yml to call the shared script - Added GitLab CI/CD Component (templates/prevent-overwrites.yml) - Updated README with GitLab usage documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Script URL is now constructed from CI_SERVER_URL, allowing automatic detection of the GitLab instance. Replaced script-source input with script-repo-path and script-version for more flexibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The web UI raw endpoint (/-/raw/) requires browser session authentication and returns an HTML login page when accessed with a job token. The Repository Files API properly supports JOB-TOKEN header authentication. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The JOB-TOKEN header only works for same-project API access. For cross-project access, GitLab requires Basic Auth with gitlab-ci-token as the username and CI_JOB_TOKEN as the password. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Branch names like 'feature/gitlab' contain slashes that must be URL-encoded (%2F) in query parameters for the GitLab API. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GitLab's Repository Files API requires the file path to be URL-encoded, including periods (. -> %2E) as shown in their documentation examples. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The GitLab Repository Files API has complex URL encoding requirements and permission issues. Using git archive with CI job token provides more reliable cross-project file access. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
git archive --remote is not supported over HTTPS on GitLab. Use a shallow clone (depth 1) of the component repo to fetch the script file reliably. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CI systems like GitLab checkout repositories in detached HEAD state. Use 'git push origin HEAD:<branch>' syntax which works regardless of whether HEAD is attached to a branch. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Because subsequent jobs will not see the latest commit with changes.
Allows users to configure which branches should NOT receive a branch-specific version suffix. Defaults to "main master develop release*" for backwards compatibility. Supports glob patterns. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Branch-specific versions containing special characters were not recognized (eg. `1.1.0-FEA-123_comments-SNAPSHOT` was not recognized because of the underscore). Tested on the following version strings: 1.0.0-feature-FEA-123_prevent_artifact_overwrites-SNAPSHOT 1.0.0-feature-FEA-123-prevent-artifact-overwrites-SNAPSHOT 1.0.0-SNAPSHOT 1.0.0.aplpha-SNAPSHOT 1.0.0.aplpha.1-SNAPSHOT 1.0.0.aplpha.1-FEA-SNAPSHOT 1.1.0-FEA-123-SNAPSHOT 1.1.0-FEA-123-comments-SNAPSHOT 1.1.0-FEA-123_comments-SNAPSHOT
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This eliminates all Maven invocations from the script, avoiding slow dependency downloads. Version changes are now performed via sed/grep on pom.xml files directly. The `maven-args` input is deprecated but kept for backwards compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dency versions. The sed global replacement was changing version strings inside dependency declarations that happened to match the project version. Now uses awk to target only the first <version> tag outside <parent> blocks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers: enforce branch version (with dependency preservation), already has branch version, enforcement disabled, remove branch version on core branch, remove dependency branch versions, and core branch no-op. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…iles. Replace inline sed/version-extraction assertions with whole-file diff against expected pom.xml files, making tests easier to read and maintain. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds an optional rerun-pipeline job (enabled via rerun-on-change input) that cancels the current pipeline and triggers a fresh one when prevent-overwrites pushes a new commit. Documents the new input in README. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes the separate rerun-pipeline job and moves the pipeline cancel/retrigger logic into the prevent-overwrites script section, guarded by the RERUN_ON_CHANGE variable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace git ls-remote SHA comparison with the changes-made value written by prevent-overwrites.sh to OUTPUT_FILE, avoiding an extra network call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CI_JOB_TOKEN cannot push to branches protected with "Allowed to push: No one". Fall back to CI_JOB_TOKEN when GIT_PUSH_TOKEN is not set, so existing projects are unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.