The script.sh is in a particular branch and not in master, so how do I specify in the script identifier to locate the file in that branch.
build_job:
stage: build
script:
- ./project/config/script.sh > job.yml
CodePudding user response:
If you want to swap branches during a pipeline job, then you will need to:
- Set up authentication in the
before_script
using HTTPS or SSH method, - In the
script
section, add the standard git commands, such as git checkout, to get to the correct branch, - Then have your script run.
Just keep in mind that if you've checked out the branch it's on, the job is using that branch. So, if you want to run the script against the current branch or commit, you'll have to copy the file to a temporary location that the job can access, then switch to the current branch/commit again to run the script against.