Answer the question
In order to leave comments, you need to log in
What do gitlab-ci scripts mean?
I read other people's runners and I can't understand what they mean, please help me decipher.
What does | , cut -d'/' -f2?
- export SUBDOMAIN=$(echo $CI_COMMIT_REF_NAME | cut -d'/' -f2)
export LINK=$(if [ $CI_JOB_NAME = "Run with DB" ]; then echo $SUBDOMAIN; else echo "master"; fi)
Answer the question
In order to leave comments, you need to log in
Let me fill in the gaps to make it clearer...
export SUBDOMAIN=$(echo $CI_COMMIT_REF_NAME | cut -d'/' -f2)
echo $CI_COMMIT_REF_NAME | cut -d'/' -f2
cut - remove sections from each line of files
SYNOPSIS
cut OPTION... [FILE]...
DESCRIPTION
Print selected parts of lines from each FILE to standard output.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
-b, --bytes=LIST
select only these bytes
-c, --characters=LIST
select only these characters
-d, --delimiter=DELIM
use DELIM instead of TAB for field delimiter
-f, --fields=LIST
select only these fields; also print any line that contains no de-
limiter character, unless the -s option is specified
-n (ignored)
--complement
complement the set of selected bytes, characters or fields
-s, --only-delimited
do not print lines not containing delimiters
--output-delimiter=STRING
use STRING as the output delimiter the default is to use the input
delimiter
-z, --zero-terminated
echo "a/bb/cc/d" | cut -d'/' -f2 #то на выходе мы получим строку bb
export LINK=$(if [ $CI_JOB_NAME = "Run with DB" ];
then
echo $SUBDOMAIN;
else
echo "master";
fi)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question