GitHub action to install and configure the Yontrack CLI, followed by the configuration of the build, branch & project in Yontrack, using a local configuration file.
Example:
- name: "Yontrack configuration"
id: yontrack-config
uses: nemerosa/ontrack-github-actions-cli-config@main
env:
YONTRACK_URL: ${{ vars.YONTRACK_URL }}
YONTRACK_TOKEN: ${{ secrets.YONTRACK_TOKEN }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}This step performs the following actions:
- Installs the Yontrack CLI using the latest available version (using the
github-tokento get access to the list of releases) - Sets the
yontrackCLI on the path for the subsequent steps - Configures the CLI based on the
YONTRACK_URLandYONTRACK_TOKENenvironment variables - Sends the default
.yontrack/ci.ymlto Yontrack, associated with some environment variables, to configure the build, branch and project. - Sets some environment variables to be used by the following steps. In particular, all
Yontrack CLI commands will reuse these environment variables for the
--build,--branchand--projectparameters.
It may be better to not use the latest available version of the CLI, but to use a specific version: remove
github-tokenand set theversionparameter to a known version of the CLI.
The configuration file is a YAML file expected at .yontrack/ci.yml.
You can change the path of this file using the
configinput.
See the Yontrack documentation for the format of this file.
Below are some basic examples of configuration files.
This configuration will tell Yontrack to setup the build, branch and project using default values.
version: v1
configuration: {}version: v1
configuration:
defaults:
branch:
validations:
BUILD: {}
TEST: {}
promotions:
BRONZE:
validations:
- BUILD
- TESTversion: v1
configuration:
defaults:
branch:
validations:
BUILD: {}
TEST: {}
promotions:
BRONZE:
validations:
- BUILD
- TEST
custom:
- conditions:
branch: main
branch:
validations:
RELEASE: {}
promotions:
SILVER:
validations:
- RELEASEThe following environment variables are set by this action:
YONTRACK_BUILD_IDYONTRACK_BUILD_NAMEYONTRACK_BRANCH_IDYONTRACK_BRANCH_NAMEYONTRACK_PROJECT_IDYONTRACK_PROJECT_NAME
Path to the local configuration file to use. Defaults to .yontrack.ci.yml.
List of environment variable names (one per line), to pass additionally to the default ones.
Example:
env-vars: |
APP_VERSION
SOME_VARVersion of the Yontrack CLI to install. If not specified, defaults to the latest available.
GitHub token to get the latest version of the CLI (when version is not provided).
URL of the Yontrack instance to target. If this input is set and the token one as well, this action will configure the CLI based on this information.
Authentication token to use to connect to Yontrack (required if URL is set). If this input is set and the url one as well, this action will setup the CLI based on this information.
Optional name of the configuration to create for the CLI. Defaults to default.
Optional value to override max connection retry attempts. If not set, default ontrack-cli behavior applies.
Optional value to override max wait time between connection retry attempts. If not set, default ontrack-cli behavior applies.
Version which has actually been installed.