I don't understand why the $BITBUCKET_BRANCH is empity in my release/1.1 branch.
# This is a sample build configuration for Java � Maven.# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.# Only use spaces to indent your .yml configuration.# -----# You can specify a custom docker image from Docker Hub as your build environment.image: maven:3.3.9
pipelines: branches: release/*: - step: caches: - maven - sonar script: - git clone -b $BITBUCKET_BRANCH ssh://bitbucket.org/${BITBUCKET_REPO_OWNER}/data-model.git - mvn -B -f data-model/data.model/pom.xml install - mvn -B -f std.proxy/pom.xml jacoco:prepare-agent verify -Psonar sonar:sonar master: - step: caches: - maven script: - git clone -b $BITBUCKET_BRANCH ssh://bitbucket.org/${BITBUCKET_REPO_OWNER}/data-model.git - mvn -B -f data-model/data.model/pom.xml install # installo il data-model nel repository locale dell'immagine docker # Ricavo le informazioni sull'identificaivo del progetto e della versione - "export PROJECT_ARTIFACT_ID=$(mvn -B -f web.server/pom.xml org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.artifactId | grep -Ev '(^\\[|Download\\w+:)')" - "export PROJECT_VERSION=$(mvn -B -f web.server/pom.xml org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\\[|Download\\w+:)')" # Questo è il nome del pacchetto che verr� generato - export FULL_NAME=${PROJECT_ARTIFACT_ID}-${PROJECT_VERSION}.war - echo "Rename package file name" - mv sdt.proxy/target/${FULL_NAME} sdt.proxy/target/${PROJECT_ARTIFACT_ID}-${PROJECT_VERSION}-${BITBUCKET_COMMIT}.war - mvn -B -f web.server/pom.xml package -Pstage - curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"web.server/target/${PROJECT_ARTIFACT_ID}-${PROJECT_VERSION}-${BITBUCKET_COMMIT}.war"
definitions: caches: sonar: /root/.sonar/cache
Brilliant! :D
If you remember how you solved the problem, can you note it down here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please format your code with the "Code block" format option in the future.
I've formatted it for you here: (There may be some mistakes)
# This is a sample build configuration for Java Maven.
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.# Only use spaces to indent your .yml configuration.# -----# You can specify a custom docker image from Docker Hub as your build environment.image: maven:3.3.9
pipelines:
branches:
release/*:
- step:
caches:
- maven
- sonar
script:
- git clone -b $BITBUCKET_BRANCH ssh://bitbucket.org/${BITBUCKET_REPO_OWNER}/data-model.git
- mvn -B -f data-model/data.model/pom.xml install
- mvn -B -f std.proxy/pom.xml jacoco:prepare-agent verify -Psonar sonar:sonar
master:
- step:
caches:
- maven
script:
- git clone -b $BITBUCKET_BRANCH ssh://bitbucket.org/${BITBUCKET_REPO_OWNER}/data-model.git
- mvn -B -f data-model/data.model/pom.xml install # installo il data-model nel repository locale dell'immagine docker # Ricavo le informazioni sull'identificaivo del progetto e della versione
- "export PROJECT_ARTIFACT_ID=$(mvn -B -f web.server/pom.xml org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.artifactId | grep -Ev '(^\\[|Download\\w+:)')"
- "export PROJECT_VERSION=$(mvn -B -f web.server/pom.xml org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\\[|Download\\w+:)')" # Questo è il nome del pacchetto che verr� generato
- export FULL_NAME=${PROJECT_ARTIFACT_ID}-${PROJECT_VERSION}.war
- echo "Rename package file name"
- mv sdt.proxy/target/${FULL_NAME} sdt.proxy/target/${PROJECT_ARTIFACT_ID}-${PROJECT_VERSION}-${BITBUCKET_COMMIT}.war
- mvn -B -f web.server/pom.xml package -Pstage
- curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"web.server/target/${PROJECT_ARTIFACT_ID}-${PROJECT_VERSION}-${BITBUCKET_COMMIT}.war"
definitions:
caches:
sonar: /root/.sonar/cache
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefano,
Can you run the 'env' command at the start of your build. You should see a list of environment variables and their values. $BITBUCKET_BRANCH should be populated. It is probable that it is being incorrectly referenced somewhere, making it appear empty.
Which command does it specifically appear empty in? If it's the clone command, are there any specific error messages?
Thanks,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may also want to look at this question for information on cloning another repository into your build environment: https://community.atlassian.com/t5/Bitbucket-questions/How-can-I-use-SSH-in-Bitbucket-Pipelines/qaq-p/347345
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.