Skip to content

Commit

Permalink
Re-add k3d to makefile and build image each time
Browse files Browse the repository at this point in the history
  • Loading branch information
dfarr authored Sep 29, 2022
1 parent 53b74f9 commit 9a9b2f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,10 @@ jobs:
- run: make lint
- run: git diff --exit-code

build-image:
name: Build image
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build image
run: |
make image
docker save quay.io/argoproj/argo-events:latest > /tmp/argoevents_image.tar
- name: Archive image
uses: actions/upload-artifact@v3
with:
name: argoevents
path: /tmp/argoevents_image.tar
if-no-files-found: error

e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [ build-image ]
env:
KUBECONFIG: /home/runner/.kubeconfig
strategy:
Expand Down Expand Up @@ -163,13 +144,6 @@ jobs:
echo " user:" >> $KUBECONFIG
echo " token: xxxxxx" >> $KUBECONFIG
until kubectl cluster-info ; do sleep 10s ; done
- name: Download image
uses: actions/download-artifact@v3
with:
name: argoevents
path: /tmp
- name: Load image
run: docker load < /tmp/argoevents_image.tar
- name: Run tests
run: |
make start
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ VERSION=$(GIT_TAG)
override LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
endif

K3D ?= $(shell [ "`command -v kubectl`" != '' ] && [ "`command -v k3d`" != '' ] && [[ "`kubectl config current-context`" =~ k3d-* ]] && echo true || echo false)

# Check that the needed executables are available, else exit before the build
K := $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))

Expand Down Expand Up @@ -66,6 +68,9 @@ dist/$(BINARY_NAME)-%:
image: clean dist/$(BINARY_NAME)-linux-amd64
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) --target $(BINARY_NAME) -f $(DOCKERFILE) .
@if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION); fi
ifeq ($(K3D),true)
k3d image import $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)
endif

image-linux-%: dist/$(BINARY_NAME)-linux-%
DOCKER_BUILDKIT=1 docker build --build-arg "ARCH=$*" -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$* --platform "linux/$*" --target $(BINARY_NAME) -f $(DOCKERFILE) .
Expand Down Expand Up @@ -133,7 +138,7 @@ docs/assets/diagram.png: go-diagrams/diagram.dot
cd go-diagrams && dot -Tpng diagram.dot -o ../docs/assets/diagram.png

.PHONY: start
start:
start: image
kubectl apply -f test/manifests/argo-events-ns.yaml
kubectl kustomize test/manifests | sed 's@quay.io/argoproj/@$(IMAGE_NAMESPACE)/@' | sed 's/:$(BASE_VERSION)/:$(VERSION)/' | kubectl -n argo-events apply -l app.kubernetes.io/part-of=argo-events --prune=false --force -f -
kubectl -n argo-events wait --for=condition=Ready --timeout 60s pod --all
Expand Down

0 comments on commit 9a9b2f5

Please sign in to comment.