Skip to content

Commit

Permalink
Remove Dapper (#301)
Browse files Browse the repository at this point in the history
* Simplify no-dapper workflow

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Bump goimports

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Remove dapper from build system

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Remove dapper base image

Signed-off-by: Derek Nola <derek.nola@suse.com>

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
  • Loading branch information
dereknola authored May 31, 2024
1 parent edd8f35 commit fd54e00
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 82 deletions.
32 changes: 19 additions & 13 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ platform:

steps:
- name: build
image: rancher/dapper:v0.6.0
image: docker:25.0.5
commands:
- dapper ci
- apk add make git bash file
- git config --global --add safe.directory /drone/src
- make
environment:
ARCH: "${DRONE_STAGE_ARCH}"
volumes:
Expand Down Expand Up @@ -68,7 +70,7 @@ steps:
- refs/tags/*

- name: test-image
image: rancher/dapper:v0.6.0
image: docker:25.0.5
commands:
- docker build -t kine:test-${DRONE_COMMIT} -f Dockerfile.test .
environment:
Expand All @@ -81,7 +83,7 @@ steps:
- pull_request

- name: test-sqlite
image: rancher/dapper:v0.6.0
image: docker:25.0.5
depends_on:
- build
- test-image
Expand All @@ -98,7 +100,7 @@ steps:
- pull_request

- name: test-mysql
image: rancher/dapper:v0.6.0
image: docker:25.0.5
depends_on:
- build
- test-image
Expand All @@ -115,7 +117,7 @@ steps:
- pull_request

- name: test-postgres
image: rancher/dapper:v0.6.0
image: docker:25.0.5
depends_on:
- build
- test-image
Expand All @@ -132,7 +134,7 @@ steps:
- pull_request

- name: test-cockroachdb
image: rancher/dapper:v0.6.0
image: docker:25.0.5
depends_on:
- build
- test-image
Expand All @@ -149,7 +151,7 @@ steps:
- pull_request

- name: test-schema-migration
image: rancher/dapper:v0.6.0
image: docker:25.0.5
depends_on:
- build
- test-image
Expand All @@ -166,7 +168,7 @@ steps:
- pull_request

- name: test-nats
image: rancher/dapper:v0.6.0
image: docker:25.0.5
depends_on:
- build
- test-image
Expand Down Expand Up @@ -206,9 +208,11 @@ platform:

steps:
- name: build
image: rancher/dapper:v0.6.0
image: docker:25.0.5
commands:
- dapper ci
- apk add make git bash file
- git config --global --add safe.directory /drone/src
- make
environment:
ARCH: "${DRONE_STAGE_ARCH}"
volumes:
Expand Down Expand Up @@ -280,9 +284,11 @@ platform:

steps:
- name: build
image: rancher/dapper:v0.5.0 # Fixed to v0.5.0 as newer versions of dapper don't work on arm
image: docker:25.0.5
commands:
- dapper ci
- apk add make git bash file
- git config --global --add safe.directory /drone/src
- make
environment:
ARCH: "${DRONE_STAGE_ARCH}"
volumes:
Expand Down
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
FROM golang:1.21-alpine3.18 AS infra
ARG ARCH=amd64

RUN apk -U add bash coreutils git gcc musl-dev docker-cli vim less file curl wget ca-certificates
# go imports version gopls/v0.14.1
RUN apk -U add bash coreutils git gcc musl-dev vim less curl wget ca-certificates
# go imports version gopls/v0.15.3
# https://github.com/golang/tools/releases/latest
RUN go install golang.org/x/tools/cmd/goimports@e985f842fa05caad2f3486f0711512aedffbcda8
RUN go install golang.org/x/tools/cmd/goimports@cd70d50baa6daa949efa12e295e10829f3a7bd46
RUN rm -rf /go/src /go/pkg
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s; \
Expand Down Expand Up @@ -41,10 +41,6 @@ RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
./scripts/build

COPY ./scripts/package ./scripts/entry ./scripts/
COPY ./package ./package
CMD ./scripts/entry package

FROM scratch as binary
ENV SRC_DIR=/go/src/github.com/k3s-io/kine
COPY --from=build ${SRC_DIR}/bin /bin
24 changes: 0 additions & 24 deletions Dockerfile.dapper

This file was deleted.

28 changes: 9 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
TARGETS := $(shell ls scripts | grep -v \\.sh)

.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/v0.6.0/dapper-$$(uname -s)-$$(uname -m) > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper

$(TARGETS): .dapper
./.dapper $@

.DEFAULT_GOAL := ci

ARCH ?= amd64
Expand All @@ -20,16 +8,18 @@ ifneq ($(DIRTY),)
DIRTY="-dirty"
endif

.PHONY: no-dapper
no-dapper:
.PHONY: validate
validate:
DOCKER_BUILDKIT=1 docker build \
$(DEFAULT_BUILD_ARGS) --build-arg="SKIP_VALIDATE=$(SKIP_VALIDATE)" \
--target=validate -f Dockerfile .
DOCKER_BUILDKIT=1 docker build \
$(DEFAULT_BUILD_ARGS) --build-arg="DRONE_TAG=$(DRONE_TAG)" --build-arg="CROSS=$(CROSS)" \
-f Dockerfile --target=build -t kine-build .

.PHONY: build
build:
DOCKER_BUILDKIT=1 docker build \
$(DEFAULT_BUILD_ARGS) --build-arg="DRONE_TAG=$(DRONE_TAG)" --build-arg="CROSS=$(CROSS)" \
-f Dockerfile --target=binary --output=. .
DOCKER_BUILDKIT=1 docker run -v /var/run/docker.sock:/var/run/docker.sock -v ./dist:/go/src/github.com/k3s-io/kine/dist \
-e DAPPER_UID=1000 -e DAPPER_GID=1000 -e IMAGE_NAME -e DRONE_TAG -e DIRTY=$(DIRTY) kine-build

.PHONY: ci
ci: validate build
ARCH=$(ARCH) ./scripts/package
8 changes: 0 additions & 8 deletions scripts/ci

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/entry

This file was deleted.

0 comments on commit fd54e00

Please sign in to comment.