Sets an npm package.json property
Params:
$1 the receiver var
$2 the project file
$3 the property name
Sets an npm package.json property
Params:
$1 the project file
$2 the property name
$3 the property value
Parses a semver into its complonent digits
- "v" prefix is suppored and stripped
- all params are optional and accept ""
Params:
$1 major version receiver var
$2 minor version receiver var
$3 patch version receiver var
$4 tag version receiver var
$5 semver to parse
Extended version of _semver_parse that also supports 4 digit versions
Increments a semver
Also supports:
- version prefix (v1.2.3)
- version tags (1.2.3-SNAPSHOT)
Params:
$1 receiver var
$2 base semver
$3 major increment
$4 minor increment
$5 patch increment
Updates or add a tag to a version string
Params:
$1 the destination var
$2 the source version
$3 the new tag to set
Compares 2 sem version and return
- 1 if the first is > than the second
- 0 if they are equals
- -1 if the first is < than the second
Params:
$1 destination var
$2 the first var
$3 the second version
Prints the current callstack
Options
[-d] to debug tty
[-n] doesn't print the decoration frame
Params:
$1 start from this element of the start
$2 number of start
$3 title
$4 print command to use
Prints the current function name with decorations
Params:
$1 prefix decoration
$2 suffix decoration
Pretty debug prints of variables
Params:
[-d] prints to the debug tty
[-t title] also print a title
- all params are optional and accept ""
Params:
$@ a list of variable names to pretty print (so without dereference operator "$")
Adjust a variable for pretty printing
Params:
$1: the variable to cut
$2: the max len
Validates for non-null a list of mandatory variables
Fatals if a violation is found
Verifies a condition
Expects a value to match an expected value according with an operator.
If the verification fails an error and a callstack are printed.
The function assumes to be wrapped so it skips 2 levels of the callstack.
Syntax1 - Params:
$1: The error messages prefix
$2: Name of the variable containing the value to test
$3: Operator
$4: expected value
Syntax2 - Params:
$1: The error messages prefix
$2: -v
$3: A description of value
$4: A value to test
$5: Operator
$6: expected value
See __VERIFY_EXPRESSION
Drops a shell that inherits the caller environment
Adds a token or replaces a tocken to/in a URL
Params:
$1 destination var
$2 url
$3 token
Gets the prefix of the PR title
Params:
$1 destination var
$2 the PR title
shellcheck disable=SC2034
Setups the enviroment for a macro execution
Params:
$1 macro name
$.. macro-specific parameters
shellcheck disable=SC2034
Stops the execution with a success result and an info message
Params:
$1 message
Options:
-d logs using _log_d instead of _log_i
STOP ON ERROR
Options:
--pipe N checks the result of the part #N of a pipe expression, can be specified up to 3 times
Sets a variable given the name and the value
WARNING:
This function can be used to set a variable of the caller's scope and this tecnique
is commonly used to return values to the caller.
But note that if there is a variable with same name in the local scope, the local one
is preferred leaving the caller's variable untouched.
That's why functions that returns values uses a special naming convention for their
internal variables (_tmp_...).
Params:
- $1: variable to set
- $2: value
Waits for a condition on given resource
$1: max wait
$2: condition (until-present, until-not-present)
$3: resource type
$4: resource name
Logins to an OKD instance given the related OKD variables
Required environment variables:
ENTANDO_OPT_OKD_LOGIN_URL the url of the OKD instance
ENTANDO_OPT_OKD_LOGIN_TOKEN the tocken to use for the login operation
ENTANDO_OPT_OKD_LOGIN_NAMESPACE the namespace to use
Optional environment variables:
ENTANDO_OPT_OKD_LOGIN_INSECURE forces a TLS-insecure login (default: false)
ENTANDO_OPT_OKD_CLI_URL the URL from which the download tool should be downloaded
Note that this is a semicolon-delimited list, where the first element
is the url and the others are the optional curl options
Deletes and recreates a namespace
Filters out from the standard-input the triple-dash (---) separed documents that matches the given kind
Params:
$1 document kind
Installs a command given its package name
Params:
$1: name of the package
Options:
-c command command to check if != package name
--tar-install url installation based on the url of the executable archive
Installs a package given its apt package name
Installs a package given a link to a tarball
$1: semicolon-delimited list containing:
position #1 the url
position #2..4 3 additional args for the curl command
this limited syntax was implemented mostly to allow specifying "--insecure"
note that all the args are individually quoted
Ensures that a mandatory command is avaliable
Params:
$1: command
[$2]: optional description of the command
Checks for the presence of a command
Params:
$1: the command
Options:
[-m] if provided failing finding the command is fatal
Successfully runs a maven command or fatals.
Unless otherise specified it summarize the output.
Special Options:
--ppl-simple: doesn't summarize the output
--ppl-timestamp: adds a timestamp to every output line
Runs a maven deploy over the received environment params
Params:
$1: repository id
$2: repository url
Runs an arbitrary git command and FATALS if it fails
Sets the repository defaults
Runs a git init and sets the repository defaults
Clones a repository and the tags
Params:
$1: repository url
$2: optional dest dir or ""
$3: optional branch to checkout or ""
$4: optional token
Sets the git commit config
Options:
--global: sets the info globally
Params:
$1: user name
$2: user email
Sets the git commit config of the local repo
according with the information on the environment
Expected Vars:
GIT_USER_NAME: user name
GIT_USER_EMAIL: user email
Extract the tag(s) on the given gitref string
Params:
$1: dest var
$2: git-ref
Returns the commit id of the current local repo
Returns the tag with the highest value
Note that the command by default filters out the preview versions
Options:
--for: specifies the base version for the search (eg: 6.3 only looks for 6.3.* tags)
Params:
$1: the output var
Add-Commit-Tag-Push
Params:
$1 the commit message
$2 the tag id (if not provided tagging is not executed)
$3 the remote branch (if not provided push is not executed, if "-" a push with no params is executed)
Checkouts a branch
Params:
$1: the branch to checkout
Sets the receiver var with the the current git branch
Merges current branch into the target one, by overriding the target.
At the end of the operation the current branch and the target branch will be identical
Params:
$1: the target branch
tag generation
always generate an heavy tag
Params:
$1: the tag name
$2: the optional message (autogenerated if not provided)
$3: the optional commit id (HEAD if not provided)
Extract the given commit tag
Options:
--snapshot-tag filters for snapshot tags
--pseudo-snapshot-tag filters for pseudo snapshot tags
Params:
$1 the output var
$2 the commit reference
Extract the parent PR of the given commit
Options:
--tolerant disables the "MUST-WORK" contraint of the double-underscore functions
Params:
$1 the output var
$2 the commit reference
Tells if a given commit reference exists on the repo
Fails if the worktre has uncommitted or untracked files
Runs a docker operation and summarise the output
Params:
$@: all params are forwarded to the docker command and params of _summarize_stream
Runs a docker operation
Params:
$@: all params are forwarded to the docker command
Tells if a image is present on the registry
registry is taken from the given address or falls back as for docker standard policies
Params:
$1: the image address
Extacts the artifactId from a pom
Params:
$1: dest var
$2: pom file pathname
Extacts the version of a artifactId from a pom
Params:
$1: dest var
$2: pom file pathname
Sets the version of a artifactId from a pom
Params:
$1: new version
$2: pom file pathname
Extacts a property from a pom
Params:
$1: dest var
$2: pom file pathname
$3: property name
Sets a property from a pom
Params:
$1: new value
$2: pom file pathname
$3: property name
Extacts the version of an artifact dependency of the dependency management section
Params:
$1: dest var
$2: pom file pathname
$3: the artifact id
Gets a pom property
Params:
$1 the receiver var
$2 the pom file
$3 the XML path of the property to set
$4 the property name
Sets a pom property
Params:
$1 the value to set
$2 the pom file
$3 the XML path of the property to set
$4 the property name
Sets an npm package.json property
Params:
$1 the receiver var
$2 the project file
$3 the property name
Sets an npm package.json property
Params:
$1 the project file
$2 the property name
$3 the property value
Parses a semver into its complonent digits
- "v" prefix is suppored and stripped
- all params are optional and accept ""
Params:
$1 major version receiver var
$2 minor version receiver var
$3 patch version receiver var
$4 tag version receiver var
$5 semver to parse
Extended version of _semver_parse that also supports 4 digit versions
Increments a semver
Also supports:
- version prefix (v1.2.3)
- version tags (1.2.3-SNAPSHOT)
Params:
$1 receiver var
$2 base semver
$3 major increment
$4 minor increment
$5 patch increment
Updates or add a tag to a version string
Params:
$1 the destination var
$2 the source version
$3 the new tag to set
Compares 2 sem version and return
- 1 if the first is > than the second
- 0 if they are equals
- -1 if the first is < than the second
Params:
$1 destination var
$2 the first var
$3 the second version
Prints the current callstack
Options
[-d] to debug tty
[-n] doesn't print the decoration frame
Params:
$1 start from this element of the start
$2 number of start
$3 title
$4 print command to use
Prints the current function name with decorations
Params:
$1 prefix decoration
$2 suffix decoration
Pretty debug prints of variables
Params:
[-d] prints to the debug tty
[-t title] also print a title
- all params are optional and accept ""
Params:
$@ a list of variable names to pretty print (so without dereference operator "$")
Adjust a variable for pretty printing
Params:
$1: the variable to cut
$2: the max len
Validates for non-null a list of mandatory variables
Fatals if a violation is found
Verifies a condition
Expects a value to match an expected value according with an operator.
If the verification fails an error and a callstack are printed.
The function assumes to be wrapped so it skips 2 levels of the callstack.
Syntax1 - Params:
$1: The error messages prefix
$2: Name of the variable containing the value to test
$3: Operator
$4: expected value
Syntax2 - Params:
$1: The error messages prefix
$2: -v
$3: A description of value
$4: A value to test
$5: Operator
$6: expected value
See __VERIFY_EXPRESSION
Drops a shell that inherits the caller environment
Adds a token or replaces a tocken to/in a URL
Params:
$1 destination var
$2 url
$3 token
Gets the prefix of the PR title
Params:
$1 destination var
$2 the PR title
shellcheck disable=SC2034
Setups the enviroment for a macro execution
Params:
$1 macro name
$.. macro-specific parameters
shellcheck disable=SC2034
Stops the execution with a success result and an info message
Params:
$1 message
Options:
-d logs using _log_d instead of _log_i
STOP ON ERROR
Options:
--pipe N checks the result of the part #N of a pipe expression, can be specified up to 3 times
Sets a variable given the name and the value
WARNING:
This function can be used to set a variable of the caller's scope and this tecnique
is commonly used to return values to the caller.
But note that if there is a variable with same name in the local scope, the local one
is preferred leaving the caller's variable untouched.
That's why functions that returns values uses a special naming convention for their
internal variables (_tmp_...).
Params:
- $1: variable to set
- $2: value
Waits for a condition on given resource
$1: max wait
$2: condition (until-present, until-not-present)
$3: resource type
$4: resource name
Logins to an OKD instance given the related OKD variables
Required environment variables:
ENTANDO_OPT_OKD_LOGIN_URL the url of the OKD instance
ENTANDO_OPT_OKD_LOGIN_TOKEN the tocken to use for the login operation
ENTANDO_OPT_OKD_LOGIN_NAMESPACE the namespace to use
Optional environment variables:
ENTANDO_OPT_OKD_LOGIN_INSECURE forces a TLS-insecure login (default: false)
ENTANDO_OPT_OKD_CLI_URL the URL from which the download tool should be downloaded
Note that this is a semicolon-delimited list, where the first element
is the url and the others are the optional curl options
Deletes and recreates a namespace
Filters out from the standard-input the triple-dash (---) separed documents that matches the given kind
Params:
$1 document kind
Installs a command given its package name
Params:
$1: name of the package
Options:
-c command command to check if != package name
--tar-install url installation based on the url of the executable archive
Installs a package given its apt package name
Installs a package given a link to a tarball
$1: semicolon-delimited list containing:
position #1 the url
position #2..4 3 additional args for the curl command
this limited syntax was implemented mostly to allow specifying "--insecure"
note that all the args are individually quoted
Ensures that a mandatory command is avaliable
Params:
$1: command
[$2]: optional description of the command
Checks for the presence of a command
Params:
$1: the command
Options:
[-m] if provided failing finding the command is fatal
Successfully runs a maven command or fatals.
Unless otherise specified it summarize the output.
Special Options:
--ppl-simple: doesn't summarize the output
--ppl-timestamp: adds a timestamp to every output line
Runs a maven deploy over the received environment params
Params:
$1: repository id
$2: repository url
Runs an arbitrary git command and FATALS if it fails
Sets the repository defaults
Runs a git init and sets the repository defaults
Clones a repository and the tags
Params:
$1: repository url
$2: optional dest dir or ""
$3: optional branch to checkout or ""
$4: optional token
Sets the git commit config
Options:
--global: sets the info globally
Params:
$1: user name
$2: user email
Sets the git commit config of the local repo
according with the information on the environment
Expected Vars:
GIT_USER_NAME: user name
GIT_USER_EMAIL: user email
Extract the tag(s) on the given gitref string
Params:
$1: dest var
$2: git-ref
Returns the commit id of the current local repo
Returns the tag with the highest value
Note that the command by default filters out the preview versions
Options:
--for: specifies the base version for the search (eg: 6.3 only looks for 6.3.* tags)
Params:
$1: the output var
Add-Commit-Tag-Push
Params:
$1 the commit message
$2 the tag id (if not provided tagging is not executed)
$3 the remote branch (if not provided push is not executed, if "-" a push with no params is executed)
Checkouts a branch
Params:
$1: the branch to checkout
Sets the receiver var with the the current git branch
Merges current branch into the target one, by overriding the target.
At the end of the operation the current branch and the target branch will be identical
Params:
$1: the target branch
tag generation
always generate an heavy tag
Params:
$1: the tag name
$2: the optional message (autogenerated if not provided)
$3: the optional commit id (HEAD if not provided)
Extract the given commit tag
Options:
--snapshot-tag filters for snapshot tags
--pseudo-snapshot-tag filters for pseudo snapshot tags
Params:
$1 the output var
$2 the commit reference
Extract the parent PR of the given commit
Options:
--tolerant disables the "MUST-WORK" contraint of the double-underscore functions
Params:
$1 the output var
$2 the commit reference
Tells if a given commit reference exists on the repo
Fails if the worktre has uncommitted or untracked files
Runs a docker operation and summarise the output
Params:
$@: all params are forwarded to the docker command and params of _summarize_stream
Runs a docker operation
Params:
$@: all params are forwarded to the docker command
Tells if a image is present on the registry
registry is taken from the given address or falls back as for docker standard policies
Params:
$1: the image address
Extacts the artifactId from a pom
Params:
$1: dest var
$2: pom file pathname
Extacts the version of a artifactId from a pom
Params:
$1: dest var
$2: pom file pathname
Sets the version of a artifactId from a pom
Params:
$1: new version
$2: pom file pathname
Extacts a property from a pom
Params:
$1: dest var
$2: pom file pathname
$3: property name
Sets a property from a pom
Params:
$1: new value
$2: pom file pathname
$3: property name
Extacts the version of an artifact dependency of the dependency management section
Params:
$1: dest var
$2: pom file pathname
$3: the artifact id
Gets a pom property
Params:
$1 the receiver var
$2 the pom file
$3 the XML path of the property to set
$4 the property name
Sets a pom property
Params:
$1 the value to set
$2 the pom file
$3 the XML path of the property to set
$4 the property name
Clones a repository and the tags
Params:
$1: repository url
$2: optional dest dir or ""
$3: optional branch to checkout or ""
$4: optional token
Sets the git commit config
Options:
--global: sets the info globally
Params:
$1: user name
$2: user email
Sets the git commit config of the local repo
according with the information on the environment
Expected Vars:
GIT_USER_NAME: user name
GIT_USER_EMAIL: user email
Extract the tag(s) on the given gitref string
Params:
$1: dest var
$2: git-ref
Returns the commit id of the current local repo
Returns the tag with the highest value
Note that the command by default filters out the preview versions
Options:
--for: specifies the base version for the search (eg: 6.3 only looks for 6.3.* tags)
Params:
$1: the output var
Sets the receiver var with the the current git branch
Tells if a given commit reference exists on the repo
Fails if the worktre has uncommitted or untracked files