diff --git a/Makefile b/Makefile index a87fa179..1a182b51 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,9 @@ else NAME ?= summerwind/actions-runner-controller endif DOCKER_USER ?= $(shell echo ${NAME} | cut -d / -f1) -RUNNER_NAME ?= ${DOCKER_USER}/actions-runner VERSION ?= latest +RUNNER_NAME ?= ${DOCKER_USER}/actions-runner +RUNNER_TAG ?= ${VERSION} TEST_REPO ?= ${DOCKER_USER}/actions-runner-controller SYNC_PERIOD ?= 5m @@ -116,7 +117,7 @@ generate: controller-gen # Build the docker image docker-build: docker build . -t ${NAME}:${VERSION} - docker build runner -t ${RUNNER_NAME}:${VERSION} --build-arg TARGETPLATFORM=$(shell arch) + docker build runner -t ${RUNNER_NAME}:${RUNNER_TAG} --build-arg TARGETPLATFORM=$(shell arch) docker-buildx: export DOCKER_CLI_EXPERIMENTAL=enabled @@ -133,7 +134,7 @@ docker-buildx: # Push the docker image docker-push: docker push ${NAME}:${VERSION} - docker push ${RUNNER_NAME}:${VERSION} + docker push ${RUNNER_NAME}:${RUNNER_TAG} # Generate the release manifest file release: manifests @@ -163,7 +164,7 @@ acceptance/kind: acceptance/load: kind load docker-image ${NAME}:${VERSION} --name acceptance kind load docker-image quay.io/brancz/kube-rbac-proxy:v0.8.0 --name acceptance - kind load docker-image ${RUNNER_NAME}:${VERSION} --name acceptance + kind load docker-image ${RUNNER_NAME}:${RUNNER_TAG} --name acceptance kind load docker-image docker:dind --name acceptance kind load docker-image quay.io/jetstack/cert-manager-controller:v1.0.4 --name acceptance kind load docker-image quay.io/jetstack/cert-manager-cainjector:v1.0.4 --name acceptance @@ -191,7 +192,7 @@ acceptance/teardown: kind delete cluster --name acceptance acceptance/deploy: - NAME=${NAME} RUNNER_NAME=${RUNNER_NAME} DOCKER_USER=${DOCKER_USER} VERSION=${VERSION} TEST_REPO=${TEST_REPO} acceptance/deploy.sh + NAME=${NAME} DOCKER_USER=${DOCKER_USER} VERSION=${VERSION} RUNNER_NAME=${RUNNER_NAME} RUNNER_TAG=${RUNNER_TAG} TEST_REPO=${TEST_REPO} acceptance/deploy.sh acceptance/tests: acceptance/checks.sh diff --git a/README.md b/README.md index 7b7b270d..0e6b1b31 100644 --- a/README.md +++ b/README.md @@ -869,6 +869,24 @@ KUBECONFIG=path/to/kubeconfig \ **Development Tips** +Rerunnig the whole acceptance test suite from scratch on every little change to the controller, the runner, and the chart would be counter-productive. + +To make your developent cycle faster, use the below command to update deploy and update all the three: + +``` +# Let assume we have all other envvars like DOCKER_USER, GITHUB_TOKEN already set, +# The below command will (re)build `actions-runner-controller:controller1` and `actions-runner:runner1`, +# load those into kind nodes, and then rerun kubectl or helm to install/upgrade the controller, +# and finally upgrade the runner deployment to use the new runner image. +# +# As helm 3 and kubectl is unable to recreate a pod when no tag change, +# you either need to bump VERSION and RUNNER_TAG on each run, +# or manually run `kubectl delete pod $POD` on respective pods for changes to actually take effect. +VERSION=controller1 \ + RUNNER_TAG=runner1 \ + make docker-build acceptance/load acceptance/deploy +``` + If you've already deployed actions-runner-controller and only want to recreate pods to use the newer image, you can run: ``` diff --git a/acceptance/testdata/runnerdeploy.yaml b/acceptance/testdata/runnerdeploy.yaml index 3d449e51..4074a178 100644 --- a/acceptance/testdata/runnerdeploy.yaml +++ b/acceptance/testdata/runnerdeploy.yaml @@ -11,7 +11,7 @@ spec: # # Custom runner image # - image: ${RUNNER_NAME}:${VERSION} + image: ${RUNNER_NAME}:${RUNNER_TAG} imagePullPolicy: IfNotPresent #