make docker-build VERSION=0.4.0-pre REGISTRY=registry ORG=org REPO=repo -t
In CI, the VERSION (build argument) is inferred based on GITHUB_REF_NAME:
When the Git ref (branch/tag name) matches ^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$, VERSION is set to GITHUB_REF_NAME (with all slashes replaced with dashes);
otherwise, VERSION is set to the actual Git ref (i.e. github.sha)
Verification steps
Setup a cluster to target the operator to:
kind create cluster
kubectl create namespace authorino-operator
make install
For each scenario below, build and run the operator. In all the cases, you should spot a message 'booting up authorino operator' in the Authorino Operator logs, with a label version set accordingly.
Scenario: Build and run the binary locally
Run the binary locally:
make run
[…]
go run -ldflags "-X main.version=fff12b68926ddf72646a7ba9653cd7ed426c0816" ./main.go
1.6615074731805818e+09 INFO setup botting up authorino operator {"version": "fff12b68926ddf72646a7ba9653cd7ed426c0816"}
Try with a version number:
make run VERSION=0.4.0-pre
[…]
go run -ldflags "-X main.version=0.4.0-pre" ./main.go
1.661507509064471e+09 INFO setup botting up authorino operator {"version": "0.4.0-pre"}
Scenario: Build and run container image in docker
Setup a cluster to target the operator to:
kind create cluster
kubectl create namespace authorino-operator
make install
Build and run container image in docker:
make docker-build
docker run \
-v $HOME/.kube/config:/home/.kube/config \
--env KUBECONFIG=/home/.kube/config \
--network=host \
quay.io/kuadrant/authorino-operator:latest
Try with a version number:
make docker-build VERSION=0.4.0-pre
docker run \
-v $HOME/.kube/config:/home/.kube/config \
--env KUBECONFIG=/home/.kube/config \
--network=host \
quay.io/kuadrant/authorino-operator:v0.4.0-pre
The Authorino Operator version info can be specified by setting an ldflag
main.version
in thego build
command. E.g.When using the Makefile:
VERSION
is not specified, it defaults to the Git ref (SHA-1) of HEAD;IMAGE_TAG
) is inferred from the value ofVERSION
(user-defined or set to default):^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$
(e.g. '0.10.0-pre'), the tag is set tov$VERSION
(e.g. 'v0.10.0-pre');To build a container image:
VERSION
. E.g.-- OR --
In CI, the
VERSION
(build argument) is inferred based onGITHUB_REF_NAME
:^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$
,VERSION
is set toGITHUB_REF_NAME
(with all slashes replaced with dashes);VERSION
is set to the actual Git ref (i.e.github.sha
)Verification steps
Setup a cluster to target the operator to:
For each scenario below, build and run the operator. In all the cases, you should spot a message 'booting up authorino operator' in the Authorino Operator logs, with a label
version
set accordingly.Scenario: Build and run the binary locally
Run the binary locally:
Try with a version number:
Scenario: Build and run container image in docker
Setup a cluster to target the operator to:
Build and run container image in docker:
Try with a version number: