Make development cycle faster (#508)
Improves Makefile, acceptance/deploy.sh, acceptance/testdata/runnerdeploy.yaml, and the documentation to help developers and contributors.
This commit is contained in:
parent
588872a316
commit
e00b3b9714
11
Makefile
11
Makefile
|
|
@ -4,8 +4,9 @@ else
|
||||||
NAME ?= summerwind/actions-runner-controller
|
NAME ?= summerwind/actions-runner-controller
|
||||||
endif
|
endif
|
||||||
DOCKER_USER ?= $(shell echo ${NAME} | cut -d / -f1)
|
DOCKER_USER ?= $(shell echo ${NAME} | cut -d / -f1)
|
||||||
RUNNER_NAME ?= ${DOCKER_USER}/actions-runner
|
|
||||||
VERSION ?= latest
|
VERSION ?= latest
|
||||||
|
RUNNER_NAME ?= ${DOCKER_USER}/actions-runner
|
||||||
|
RUNNER_TAG ?= ${VERSION}
|
||||||
TEST_REPO ?= ${DOCKER_USER}/actions-runner-controller
|
TEST_REPO ?= ${DOCKER_USER}/actions-runner-controller
|
||||||
SYNC_PERIOD ?= 5m
|
SYNC_PERIOD ?= 5m
|
||||||
|
|
||||||
|
|
@ -116,7 +117,7 @@ generate: controller-gen
|
||||||
# Build the docker image
|
# Build the docker image
|
||||||
docker-build:
|
docker-build:
|
||||||
docker build . -t ${NAME}:${VERSION}
|
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:
|
docker-buildx:
|
||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
|
|
@ -133,7 +134,7 @@ docker-buildx:
|
||||||
# Push the docker image
|
# Push the docker image
|
||||||
docker-push:
|
docker-push:
|
||||||
docker push ${NAME}:${VERSION}
|
docker push ${NAME}:${VERSION}
|
||||||
docker push ${RUNNER_NAME}:${VERSION}
|
docker push ${RUNNER_NAME}:${RUNNER_TAG}
|
||||||
|
|
||||||
# Generate the release manifest file
|
# Generate the release manifest file
|
||||||
release: manifests
|
release: manifests
|
||||||
|
|
@ -163,7 +164,7 @@ acceptance/kind:
|
||||||
acceptance/load:
|
acceptance/load:
|
||||||
kind load docker-image ${NAME}:${VERSION} --name acceptance
|
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 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 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-controller:v1.0.4 --name acceptance
|
||||||
kind load docker-image quay.io/jetstack/cert-manager-cainjector: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
|
kind delete cluster --name acceptance
|
||||||
|
|
||||||
acceptance/deploy:
|
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/tests:
|
||||||
acceptance/checks.sh
|
acceptance/checks.sh
|
||||||
|
|
|
||||||
18
README.md
18
README.md
|
|
@ -869,6 +869,24 @@ KUBECONFIG=path/to/kubeconfig \
|
||||||
|
|
||||||
**Development Tips**
|
**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:
|
If you've already deployed actions-runner-controller and only want to recreate pods to use the newer image, you can run:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ spec:
|
||||||
#
|
#
|
||||||
# Custom runner image
|
# Custom runner image
|
||||||
#
|
#
|
||||||
image: ${RUNNER_NAME}:${VERSION}
|
image: ${RUNNER_NAME}:${RUNNER_TAG}
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue