I have been trying to set up a Jenkins pipeline to automate my deployment.The process that I am trying to implement is we will have four main branches(validate,develop,uat,master).When a merge request is opened in GitLab(From validate/* to develop, develop/* to uat etc),a job should kick off and deploy the changes to our specific sandboxes.Below is a testing pipeline that i have been trying to create:
echo "is gitlabSourceRepoSshUrl" ${gitlabSourceRepoSshUrl}
echo "is gitlabBranch" ${gitlabBranch}
echo "is gitlabTargetBranch" {$gitlabTargetBranch}
echo "is gitlabSourceBranch" {$gitlabSourceBranch}
echo "ls"
ls
git clone ${gitlabSourceRepoSshUrl} .
#!/bin/bash
if [[ ${gitlabSourceBranch} == "validate/"* ]]
then
export HOME=$WORKSPACE
sfdx force:auth:jwt:grant --clientid ${CONNECTED_APP_CONSUMER_KEY} --username [email protected] --jwtkeyfile ${jwt_key_file} --setdefaultdevhubusername --instanceurl https://test.salesforce.com
sfdx force:source:deploy -x manifest/package.xml -u [email protected] --verbose
else
echo ${gitlabSourceBranch} 'is not equal to' ${SOURCE_TARGET_PATTERN}
fi
Now my issues are:
- When the repository is cloned first,it is cloned with master branch (I suppose), so my workspace at all times has the code from master branch. So if my validate/* branch has a package.xml to deploy just one object,the job tries to pick the package.xml from my workspace (which is from master branch).How can my job pick the package.xml from the validate/* branch.
- Give me your feedback for the simple draft job that i have created.Will it be a cause of concern in future by not scaling up?
I hope I have communicated it well.If not, please ask me questions.I am new to Jenkins and GitLab and I am bit struggling but i will agree that it has been a learning curve.