Reputation: 1
I am running a maven release plugin in concourse pipeline. Our Git is in GitHub Enterprise and so is our Artifactory.
I am getting the resource, I am able to build it and release a snapshot to Artifactory using deploy. But when I go for the release concourse fails with ref HEAD is not a symbolic ref
Here is my CI code that does the release:
- name: build-release
plan:
- get: tool-v2
params: {depth: 1}
#passed: [ build-docker-image ]
- task: build
config:
platform: linux
image_resource:
type: docker-image
source:
repository: adoptopenjdk/openjdk11
tag: "latest"
inputs:
- name: tool-v2
outputs:
- name: built-artifact-release
run:
path: /bin/bash
args:
- -c
- |
set -e
apt-get update && apt-get install -y git
cd tool-v2
git config --global user.email "emailadd"
git config --global user.name "Service Account"
./mvnw release:clean release:prepare -B
./mvnw release:perform -B -Darguments="-Dmaven.javadoc.skip=true -DscmCommentPrefix='[skip ci]'"
./git push --tags origin main:release
Here is the error I am getting in the pipeline:
INFO] [INFO] Replacing main artifact with repackaged archive
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 42.868 s
[INFO] [INFO] Finished at: 2023-04-20T16:52:23Z
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /tmp/build/80754af9/tool-v2 && git add -- pom.xml
[INFO] Working directory: /tmp/build/80754af9/tool-v2
[INFO] Executing: /bin/sh -c cd /tmp/build/80754af9/tool-v2 && git rev-parse --show-toplevel
[INFO] Working directory: /tmp/build/80754af9/tool-v2
[INFO] Executing: /bin/sh -c cd /tmp/build/80754af9/tool-v2 && git status --porcelain .
[INFO] Working directory: /tmp/build/80754af9/tool-v2
[WARNING] Ignoring unrecognized line: ?? pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? release.properties
[INFO] Executing: /bin/sh -c cd /tmp/build/80754af9/tool-v2 && git commit --verbose -F /tmp/maven-scm-1405815331.commit pom.xml
[INFO] Working directory: /tmp/build/80754af9/tool-v2
[INFO] Executing: /bin/sh -c cd /tmp/build/80754af9/tool-v2 && git symbolic-ref HEAD
[INFO] Working directory: /tmp/build/80754af9/xtool-v2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 59.483 s
[INFO] Finished at: 2023-04-20T16:52:23Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project tool-v2: An error is occurred in the checkin process: Exception while executing SCM command. Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
My resource:
resources:
- name: tool-v2
type: git
check_every: 1h
source:
uri: git@github_url.git
disable_ci_skip: false
branch: pipeline
version:
ref: commit-sha
private_key:
I tried all the available options. I tried adding depth from 1 to 100 still the same error. I added version: ref: commit-sha and the error still remains.
Upvotes: 0
Views: 169