Use Kosli in CI Systems #
This section provides how-to guides showing you how to use Kosli to report changes from different CI systems.
Defaulted Kosli command flags from CI variables #
The following flags are defaulted as follows in the CI systems below:
Flag | Default |
---|---|
--build-url | https://bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/addon/pipelines/home#!/results/${BITBUCKET_BUILD_NUMBER} |
--commit-url | https://bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/commits/${BITBUCKET_COMMIT} |
--commit | ${BITBUCKET_COMMIT} |
--git-commit | ${BITBUCKET_COMMIT} |
--repository | ${BITBUCKET_REPO_SLUG} |
--bitbucket-workspace | ${BITBUCKET_WORKSPACE} |
Flag | Default |
---|---|
--build-url | ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} |
--commit-url | ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA} |
--commit | ${GITHUB_SHA} |
--git-commit | ${GITHUB_SHA} |
--repository | ${GITHUB_REPOSITORY} |
--github-org | ${GITHUB_REPOSITORY_OWNER} |
Flag | Default |
---|---|
--build-url | ${CI_JOB_URL} |
--commit-url | ${CI_PROJECT_URL}/-/commit/${CI_COMMIT_SHA} |
--commit | ${CI_COMMIT_SHA} |
--git-commit | ${CI_COMMIT_SHA} |
--repository | ${CI_PROJECT_NAME} |
--gitlab-org | ${CI_PROJECT_NAMESPACE} |
Flag | Default |
---|---|
--git-commit | ${BUILD_VCS_NUMBER} |
Use Kosli in Github Actions #
To use Kosli in Github Actions workflows, you can use the kosli CLI setup action to install the CLI on your Github Actions Runner. Then, you can use all the CLI commands in your workflows.
Here is an example Github Actions workflow snippet using the kosli create flow
command:
jobs:
example:
runs-on: ubuntu-latest
env:
KOSLI_API_TOKEN: ${{ secrets.MY_KOSLI_API_TOKEN }}
KOSLI_ORG: my-org
steps:
- name: setup kosli
uses: kosli-dev/setup-cli-action@v2
- name: create flow
run: kosli create flow my-flow --template pull-request,artifact,test
Note that all CLI command flags can be set as environment variables by adding the theKOSLI_
prefix and capitalizing them. In the example above, both--api-token
and--org
flags were set from environment variables.