Core Concepts
Pipelines

Variables

4min
microtica allows you to define custom variables that can be used to parametrize the way your pipeline works in each pipeline, microtica will automatically inject a predefined set of variables like mic pipeline execution id , mic user name , mic commit ref etc that can be used in conjunction with the custom variables use pipeline variables when you want to parametrize the way your pipeline works avoid hard coding within the step execution logic avoid storing sensitive information within the pipeline yaml microtica offers two types of variables plaintext variables sensitive variables adding variables can be done during creating/modifying pipeline from the gui environment variables will automatically became available to use in pipeline runtime environment using a standard unix syntax ${variable name} in the following example, we are using predefined variables sonar url and sonar login we can reference a custom as well as microtica predefined variables directly in the step parameters in this case, we are setting the tag for the docker image to be the value of {{mic pipeline execution id}} microtica yaml steps analyseapp image node\ latest commands \ sonar scanner dsonar host url=${sonar url} dsonar login=${sonar login} dockerpush type docker push image name microtica/user service tag "{{mic pipeline execution id}}" registry dockerhub as we marked sonar login variable as sensitive, the value will be stored encrypted and securely decrypted only within the step execution boundary usage syntax use ${variable name} syntax when you want to reference the built in or custom environment variables from the commands section (i e step runtime instructions) use "{{variable name}}" syntax as a templating in the microtica yaml file variables will be replaced with the respective values before pipeline execution when using templating, always put variables in quotation marks security consideration never hard code sensitive data in pipeline yaml for security reasons, always enable the sensitive flag when specifying parameters like passwords, secret tokens or any other data which is considered as sensitive predefined variables in each step execution, microtica will automatically inject a set of predefined variables you can use within the pipeline variable description mic commit type the type of reference with the change possible values branch or tag mic commit ref commit ref for commit type branch the value will be the commit hash for tags, the values will be the name of the tag mic commit name the name of the branch or tag mic branch filter pipeline branch filter the pipeline will be triggered only if the commit branch matches the branch filter mic commit message commit message associated with the git repository revision mic git account id git account id mic git provider git provider possible values bitbucket or github mic git access token temporary git access token for the repository associate with the pipeline mic manual trigger indicates if the pipeline was triggered by git webhook or manually by the user possible values true or false mic pipeline id the pipeline id mic pipeline name the pipeline name mic pipeline execution id a unique identifier for the current pipeline execution mic pipeline execution timestamp timestamp of the pipeline trigger time in utc format mic project id project id mic user id user id for manual pipeline trigger the value is microtica user id, for git webhook it’s the git user id mic user name the name of the user who triggered the pipeline mic user avatar url of the user avatar picture mic workdir path to the git subdirectory suitable for monorepos if specified, the pipeline will be triggered only if files in the specified dir are modified microtica expects to find microtica yaml in the specified dir mic repo url repository url mic repo fullname repository full name mic repo name repository name mic repo clone url repository https clone url