go build -o konflux-build-cli main.goor statically:
CGO_ENABLED=0 go build -o konflux-build-cli main.goor in debug mode:
go build -gcflags "all=-N -l" -o konflux-build-cli main.goBuild the CLI and setup the command environment.
Parameters can be passed via CLI arguments or environment variables, CLI arguments take precedence.
./konflux-build-cli my-command --image-url quay.io/namespace/image:tag --digest sha256:abcde1234 --tags tag1 tag2 --result-sha=/tmp/my-command-result-shaAlternatively, it's possible to provide data via environment variables:
# my-command-env.sh
export KBC_MYCOMMAND_IMAGE_URL=quay.io/namespace/image:tag
export KBC_MYCOMMAND_DIGEST=sha256:abcde1234
export KBC_MYCOMMAND_TAGS='tag1 tag2'
export KBC_MYCOMMAND_SOME_FLAG=true
export KBC_MYCOMMAND_RESULTS_DIR="/tmp/my-command-results"
mkdir -p "$RESULTS_DIR"
export KBC_MYCOMMAND_RESULT_SHA="${RESULTS_DIR}/RESULT_SHA". my-command-env.sh
./konflux-build-cli my-commandor mix approaches:
export KBC_MYCOMMAND_RESULT_FILE_SHA=/tmp/my-command-result-sha
./konflux-build-cli my-command --image-url quay.io/namespace/image:tag --digest sha256:abcde1234 --tags tag1 tag2On macOS, the /tmp directory is a symbolic link to the /private/tmp directory. Some unit tests
and integration tests rely on verbatim path comparisons. To avoid unexpected failures, you can set
the TMPDIR environment variable. For example:
mkdir .tmpdir
TMPDIR="$(pwd)/.tmpdir" go test ./...To run all unit tests:
go test ./pkg/...To run or debug a specific test or run all tests in a single file, it's most convenient to use UI of your IDE. To run specific test from terminal execute:
go test -run ^TestMyCommand_SuccessScenario$ ./pkg/...or for all tests in single package:
go test ./pkg/commandsIntegration tests are located under integration_tests directory.
Check integration tests doc for more information.
The github.com/konflux-ci/dockerfile-json dependency uses a replace
directive in go.mod that points to a specific commit from the dev branch.
Update to the latest version with:
go mod edit -replace github.com/keilerkonzept/dockerfile-json=github.com/konflux-ci/dockerfile-json@dev
go mod tidy