Environment variables can be specified for pipeline steps using the environment: section:
image : registry/repo/image:tag
The environment section is not able to expand variables.
If this is needed (e.g., to alter $PATH), the variable should be defined (and exported) in the commands section:
image : registry/repo/image:tag
Bash string operations are supported to manipulate env vars.
The manipulation happens before the variable substitution.
The table below lists supported actions including examples:
Variables:
VAR: VALUE
bar: bar
FOO: foo
VERSION: v1.0.0
FILE_TYPE: .tar.gz
Action Description Original lue Manipulated value ${VAR,}lowercase first character VALUE vALUE ${VAR,,}lowercase all characters VALUE value ${bar^}uppercase first character bar Bar ${bar^^}uppercase all characters bar BAR ${VAR:3}extract substring from position 3 to end VALUE LUE ${VAR:2:3}extract 3 characters starting from position 2 VALUE AL ${VAR=FOO}set default value if VAR is unset VALUE foo ${VERSION##v}remove longest matching prefix pattern `v1.0.0 1.0.0 ${FILE_TYPE%%.gz}remove shortest matching suffix pattern .tar.gz.tar${VAR/UE/AA}replace first occurrence of UE with II VALUE VALAA
NAME Description Example CICI environment name crowCI_WORKSPACEWorkspace path where source code gets cloned to /crow/src/git.example.com/john-doe/my-repoCI_REPOrepo full name: <owner>/<name> john-doe/my-repoCI_REPO_OWNERrepo owner john-doeCI_REPO_NAMErepo name my-repoCI_REPO_REMOTE_IDrepo remote ID (= UID from forge) 82CI_REPO_URLrepo web URL https://git.example.com/john-doe/my-repoCI_REPO_CLONE_URLrepo clone URL https://git.example.com/john-doe/my-repo.gitCI_REPO_CLONE_SSH_URLrepo SSH clone URL git@git.example.com:john-doe/my-repo.gitCI_REPO_DEFAULT_BRANCHrepo default branch mainCI_REPO_PRIVATErepo is private trueCI_REPO_TRUSTED_NETWORKrepo “trusted network access” falseCI_REPO_TRUSTED_VOLUMESrepo “trusted volumes access” falseCI_REPO_TRUSTED_SECURITYrepo “trusted security access” false
NAME Description Example CI_COMMIT_SHAcommit SHA eba09b46064473a1d345da7abf28b477468e8dbdCI_COMMIT_REFcommit ref refs/heads/mainCI_COMMIT_REFSPECcommit ref spec issue-branch:mainCI_COMMIT_BRANCHcommit branch (equals target branch (CI_COMMIT_TARGET_BRANCH) for pull requests) mainCI_COMMIT_SOURCE_BRANCHcommit source branch (set only for pull request events) issue-branchCI_COMMIT_TARGET_BRANCHcommit target branch (set only for pull request events) mainCI_COMMIT_TAGcommit tag name (empty if event != tag) v1.10.3CI_COMMIT_PULL_REQUESTcommit pull request number (set only for pull request events) 1CI_COMMIT_PULL_REQUEST_LABELSlabels assigned to pull request (set only for pull request events) serverCI_COMMIT_MESSAGEcommit message Initial commitCI_COMMIT_AUTHORcommit author username john-doeCI_COMMIT_AUTHOR_EMAILcommit author email address john-doe@example.comCI_COMMIT_PRERELEASErelease is a pre-release (empty if event is not release) false
NAME Description Example CI_PIPELINE_NUMBERpipeline number 8CI_PIPELINE_PARENTnumber of parent pipeline 0CI_PIPELINE_EVENTpipeline event (see event ) push, pull_request, pull_request_merged, tag, …CI_PIPELINE_URLlink to the web UI for the pipeline https://ci.example.com/repos/7/pipeline/8CI_PIPELINE_FORGE_URLlink to the forge’s web UI for the commit(s) or tag that triggered the pipeline https://git.example.com/john-doe/my-repo/commit/eba09b46064473a1d345da7abf28b477468e8dbdCI_PIPELINE_DEPLOY_TARGETpipeline deploy target for deployment events productionCI_PIPELINE_DEPLOY_TASKpipeline deploy task for deployment events migrationCI_PIPELINE_CREATEDpipeline created UNIX timestamp 1722617519CI_PIPELINE_STARTEDpipeline started UNIX timestamp 1722617519CI_PIPELINE_FILESchanged files (empty if event is not push or pull_request), it is undefined if more than 500 files are touched [], [".crow.yml","README.md"]CI_PIPELINE_AUTHORpipeline author username octocatCI_PIPELINE_AVATARpipeline author avatar URL https://git.example.com/avatars/5dcbcadbce6f87f8abef
NAME Description Example CI_WORKFLOW_NAMEworkflow name release
NAME Description Example CI_STEP_NAMEstep name build packageCI_STEP_NUMBERstep number 0CI_STEP_STARTEDstep started UNIX timestamp 1722617519CI_STEP_URLUI URL for step https://ci.example.com/repos/7/pipeline/8
NAME Description Example CI_PREV_COMMIT_SHAprevious commit SHA 15784117e4e103f36cba75a9e29da48046eb82c4CI_PREV_COMMIT_REFprevious commit ref refs/heads/mainCI_PREV_COMMIT_REFSPECprevious commit ref spec issue-branch:mainCI_PREV_COMMIT_BRANCHprevious commit branch mainCI_PREV_COMMIT_SOURCE_BRANCHprevious commit source branch (set only for pull request events) issue-branchCI_PREV_COMMIT_TARGET_BRANCHprevious commit target branch (set only for pull request events) mainCI_PREV_COMMIT_URLprevious commit link in forge https://git.example.com/john-doe/my-repo/commit/15784117e4e103f36cba75a9e29da48046eb82c4CI_PREV_COMMIT_MESSAGEprevious commit message testCI_PREV_COMMIT_AUTHORprevious commit author username john-doeCI_PREV_COMMIT_AUTHOR_EMAILprevious commit author email address john-doe@example.com
NAME Description Example CI_PREV_PIPELINE_NUMBERprevious pipeline number 7CI_PREV_PIPELINE_PARENTprevious pipeline number of parent pipeline 0CI_PREV_PIPELINE_EVENTprevious pipeline event (see event ) push, pull_request, pull_request_merged, tag, …CI_PREV_PIPELINE_URLprevious pipeline link in CI https://ci.example.com/repos/7/pipeline/7CI_PREV_PIPELINE_FORGE_URLprevious pipeline link to event in forge https://git.example.com/john-doe/my-repo/commit/15784117e4e103f36cba75a9e29da48046eb82c4CI_PREV_PIPELINE_DEPLOY_TARGETprevious pipeline deploy target for deployment events productionCI_PREV_PIPELINE_DEPLOY_TASKprevious pipeline deploy task for deployment events migrationCI_PREV_PIPELINE_STATUSprevious pipeline status success, failureCI_PREV_PIPELINE_CREATEDprevious pipeline created UNIX timestamp 1722610173CI_PREV_PIPELINE_STARTEDprevious pipeline started UNIX timestamp 1722610173CI_PREV_PIPELINE_FINISHEDprevious pipeline finished UNIX timestamp 1722610383CI_PREV_PIPELINE_AUTHORprevious pipeline author username octocatCI_PREV_PIPELINE_AVATARprevious pipeline author avatar URL https://git.example.com/avatars/5dcbcadbce6f87f8abef
NAME Description Example CI_SYSTEM_NAMEname of the CI system crowCI_SYSTEM_URLlink to CI system https://ci.example.comCI_SYSTEM_HOSThostname of CI server ci.example.comCI_SYSTEM_VERSIONversion of the server 2.7.0
NAME Description Example CI_FORGE_TYPEname of forge bitbucket , bitbucket_dc , forgejo , gitea , github , gitlabCI_FORGE_URLroot URL of configured forge https://git.example.com
NAME Description CI_SCRIPTInternal script path. Used to call pipeline step commands. CI_NETRC_USERNAMECredentials for private repos to be able to clone data. (Only available for specific images) CI_NETRC_PASSWORDCredentials for private repos to be able to clone data. (Only available for specific images) CI_NETRC_MACHINECredentials for private repos to be able to clone data. (Only available for specific images)