0

I'm facing some issues and would be glad if someone can help me. My main goal here it's being able to save at the same pipeline, more than one job. The error it’s because the jobs does not exist for the specific branch, since I have 6 branches I don't want to modified one by one. I would like to have only one Yaml version.

When I've tried to save, GitLab show me the following errors.

Found errors in your .gitlab-ci.yml: jobs:deploy_dc_manual:needs:need job should be a string You can test your .gitlab-ci.yml in CI Lint. 

This, it is a piece of the code. Example if I am in the branch feature the job needs it´s "feature_package_build" If I am at integration branch will be expected "int_package_build".

feature_package_build: extends: .build only: - /^feature\/.*/ script: # GitLab API query - LAST=$(curl -s "sensitive data" | jq '.[0] | .sha' | sed '1q;d' | sed 's:^.\(.*\).$:\1:') - > if [ "$OLDER_COMMIT" == "none" ]; then node_modules/sfdx-cli/bin/run sfpowerkit:project:diff -d package -r ${LAST} -x --loglevel debug elif [ "$OLDER_COMMIT" != "none" ]; then node_modules/sfdx-cli/bin/run sfpowerkit:project:diff -d package -r $OLDER_COMMIT -x --loglevel debug fi int_package_build: extends: .build only: - integration script: # GitLab API query - LAST=$(curl -s "sensitive data" | jq '.[0] | .sha' | sed '1q;d' | sed 's:^.\(.*\).$:\1:') - > if [ "$OLDER_COMMIT" == "none" ]; then node_modules/sfdx-cli/bin/run sfpowerkit:project:diff -d package -r ${LAST} -x --loglevel debug elif [ "$OLDER_COMMIT" != "none" ]; then node_modules/sfdx-cli/bin/run sfpowerkit:project:diff -d package -r $OLDER_COMMIT -x --loglevel debug fi uat_package_build: extends: .build only: - uat script: # GitLab API query - LAST=$(curl -s "sensitive data" | jq '.[0] | .sha' | sed '1q;d' | sed 's:^.\(.*\).$:\1:') deploy_DC_Manual: extends: - .deployDC_Manual needs: - job: if [uat_package_build]; then fi if [feature_package_build]; then fi only: - /^feature\/.*/ - integration - uat - release - master script: - nomDeployedDC=${NONDEPLOYEDDC} - > if [ -f package/destructiveChanges.xml ] && [ "$VALIDATE" == "no" ]; then 
2
  • can you rephrase your question - and outline what exactly you want - this is alittle bit hard to grasp. Commented Oct 18, 2021 at 12:18
  • @SimonSchrottner I've added more details. Could you help me? Commented Oct 18, 2021 at 16:51

1 Answer 1

1

I assume what you are looking for is the optional-flag for the needs keyword like

deploy_DC_Manual: extends: - .deployDC_Manual needs: - job: uat_package_build optional: true - job: feature_package_build optional: true 

As this makes the needs conditional - but please be aware, that this also means if you mess up your rules, and none of those two is available, your job might be still executed.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.