Skip to content

Commit

Permalink
Use Tilt for provisioning on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Kovacs committed Feb 1, 2024
1 parent d5c5452 commit 2bffecd
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build_test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,19 @@ jobs:

- name: E2E test
run: make e2etest
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

- name: Copy logs
if: ${{ always() }}
run: docker cp tilt-control-plane:/var/log .logs

- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: kind-logs
path: .kind/kind-logs-*
name: logs
path: .logs/*

docker-build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .husky/hooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if git status --short | grep -qv "??"; then
trap unstash EXIT
fi

make generate manifests _setImage
make generate manifests
git diff --exit-code --quiet || (git status && exit 1)

make lint gosec nilcheck test
1 change: 1 addition & 0 deletions .tilt/ctlptl-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
product: kind
registry: ctlptl-registry
kindV1Alpha4Cluster:
name: tilt
nodes:
Expand Down
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -race -timeout 60s ./... -coverprofile cover.out

.PHONY: e2etest
e2etest: kind kuttl kustomize clusterctl manifests generate docker-build
e2etest: kind ctlptl tilt kuttl kustomize clusterctl manifests generate
@echo -n "LINODE_TOKEN=$(LINODE_TOKEN)" > config/default/.env.linode
@$(CONTAINER_TOOL) tag ${IMG} capli-controller:e2e
IMG=capli-controller:e2e $(KUTTL) test --config e2e/kuttl-config.yaml
make _setImage
$(CTLPTL) apply -f .tilt/ctlptl-config.yaml
$(TILT) ci --timeout 180s -f Tiltfile
$(KUTTL) test --config e2e/kuttl-config.yaml

##@ Build

Expand Down Expand Up @@ -147,11 +147,9 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

_setImage: kustomize
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}

.PHONY: deploy
deploy: manifests kustomize _setImage ## Deploy controller to the K8s cluster specified in ~/.kube/config.
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -

.PHONY: undeploy
Expand Down
6 changes: 3 additions & 3 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
docker_build("controller", ".", only=("vendor","go.mod", "go.sum", "./api", "./cloud","./cmd", "./controller", "./util"))
docker_build("controller", ".", only=("Dockerfile", "Makefile", "vendor","go.mod", "go.sum", "./api", "./cloud","./cmd", "./controller", "./util"))

local_resource(
'capi-controller-manager',
cmd='clusterctl init',
'capi-controller-manager',
cmd='clusterctl init',
)

k8s_yaml(kustomize('config/default'))
Expand Down
9 changes: 0 additions & 9 deletions e2e/kuttl-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,4 @@ kind: TestSuite
testDirs:
- e2e/basic
kindConfig: e2e/kind-config.yaml
kindContext: kuttl
startKIND: true
kindNodeCache: true
kindContainers:
- capli-controller:e2e
artifactsDir: .kind
timeout: 120
commands:
- command: clusterctl init
- command: make deploy

0 comments on commit 2bffecd

Please sign in to comment.