Commit fed7fcfa authored by Steve Azzopardi's avatar Steve Azzopardi

Merge branch 'revert-4d0337f1' into 'master'

Revert "Split `make docker` for GitLab Runner Helper into 'master'"

See merge request gitlab-org/gitlab-runner!1180
parents 4d0337f1 0985c720
Pipeline #46674507 passed with stages
in 34 minutes and 56 seconds
......@@ -70,7 +70,7 @@ helper images:
<<: *docker
stage: prebuild
script:
- make helper-docker
- make docker
artifacts:
paths:
- out/helper-images/
......
......@@ -65,9 +65,9 @@ MOCKERY_FLAGS = -note="This comment works around https://github.com/vektra/mocke
.PHONY: clean version mocks
all: deps helper-docker build
all: deps docker build
include Makefile.runner_helper.mk
include Makefile.docker.mk
help:
# Commands:
......@@ -76,7 +76,7 @@ help:
#
# Development commands:
# make install - install the version suitable for your OS as gitlab-runner
# make helper-docker - build docker dependencies
# make docker - build docker dependencies
#
# Testing commands:
# make test - run project tests
......@@ -117,12 +117,13 @@ build_simple: $(GOPATH_SETUP)
-o "out/binaries/$(NAME)" \
$(PKG)
build_current: helper-docker build_simple
build_current: docker build_simple
check_race_conditions:
@./scripts/check_race_conditions $(OUR_PACKAGES)
test: $(PKG_BUILD_DIR) helper-docker
test: $(PKG_BUILD_DIR) docker
# Running tests...
go test $(OUR_PACKAGES) $(TESTFLAGS)
parallel_test_prepare: $(GOPATH_SETUP)
......
ifeq (, $(shell docker info 2>/dev/null))
USE_PRECOMPILED_IMAGES ?= 1
endif
docker: out/helper-images/prebuilt-x86_64.tar.xz out/helper-images/prebuilt-arm.tar.xz
ifeq (, $(USE_PRECOMPILED_IMAGES))
HELPER_GO_FILES ?= $(shell find common network vendor -name '*.go')
GO_x86_64_ARCH = amd64
GO_arm_ARCH = arm
dockerfiles/build/binaries/gitlab-runner-helper.%: $(HELPER_GO_FILES) $(GOX)
gox -osarch=linux/$(GO_$*_ARCH) -ldflags "$(GO_LDFLAGS)" -output=$@ $(PKG)/apps/gitlab-runner-helper
out/helper-images/prebuilt-%.tar: dockerfiles/build/binaries/gitlab-runner-helper.%
@mkdir -p $$(dirname $@_)
docker build -t gitlab/gitlab-runner-helper:$*-$(REVISION) -f dockerfiles/build/Dockerfile.$* dockerfiles/build
-docker rm -f gitlab-runner-prebuilt-$*-$(REVISION)
docker create --name=gitlab-runner-prebuilt-$*-$(REVISION) gitlab/gitlab-runner-helper:$*-$(REVISION) /bin/sh
docker export -o $@ gitlab-runner-prebuilt-$*-$(REVISION)
docker rm -f gitlab-runner-prebuilt-$*-$(REVISION)
out/helper-images/prebuilt-%.tar.xz: out/helper-images/prebuilt-%.tar
xz -f -9 $<
else
out/helper-images/prebuilt-%.tar.xz:
$(warning WARNING: downloading prebuilt docker images that will be loaded by gitlab-runner: $@)
@mkdir -p $$(dirname $@_)
curl -o $@ https://gitlab-runner-downloads.s3.amazonaws.com/master/docker/$(shell basename $@)
endif
# -------------------------------------------------------------------------------
# The following make file does two things:
# 1. Create binaries for the gitlab-runner-helper app which can be found in
# `./apps/gitlab-runner-helper` or all the platforms we want to support.
# 2. Create Linux containers and extract their file system to be used later to
# build/publish.
#
# If you want to add a new arch or windows version you would need to add a new
# file path to the $BINARIES variables and a new GO_ARCH_{{OS}}_{{arch}} variable.
# ---------------------------------------------------------------------------
# Tar files that we want to generate from the Docker file system, this is
# genarlly used for linux based Dockerfiles.
BASE_TAR_PATH := out/helper-images/prebuilt
TAR += ${BASE_TAR_PATH}-linux_x86_64.tar.xz
TAR += ${BASE_TAR_PATH}-linux_arm.tar.xz
# Binaries that we support for the helper image. We are using the following
# pattern match:
# dockerfiles/build/binaries/gitlab-runner-helper.{{os}}_{{arch}}, these should
# match up with GO_ARCH_* variables names.
BASE_BINARY_PATH := dockerfiles/build/binaries/gitlab-runner-helper
BINARIES := ${BASE_BINARY_PATH}.windows_x86_64
BINARIES += ${BASE_BINARY_PATH}.linux_x86_64
BINARIES += ${BASE_BINARY_PATH}.linux_arm
# Define variables with the archiecture for each matching binary. We are using
# the following pattern match GO_ARCH_{{os}}_{{arch}}, these should match up
# with BINARIES variables. The value of the varible is the dist name from `go tool dist list`
GO_ARCH_linux_x86_64 = linux/amd64
GO_ARCH_linux_arm = linux/arm
GO_ARCH_windows_x86_64 = windows/amd64
# Go files that are used to create the helper binary.
HELPER_GO_FILES ?= $(shell find common network vendor -name '*.go')
.PHONY: helper-build helper-docker
# PHONY command to help build the binaries.
helper-build: $(BINARIES)
dockerfiles/build/binaries/gitlab-runner-helper.%: $(HELPER_GO_FILES) $(GOX)
gox -osarch=$(GO_ARCH_$*) -ldflags "$(GO_LDFLAGS)" -output=$@ $(PKG)/apps/gitlab-runner-helper
# PHONY command to help build the tar files for linux.
helper-docker: $(TAR)
out/helper-images/prebuilt-%.tar.xz: out/helper-images/prebuilt-%.tar
xz -f -9 $<
out/helper-images/prebuilt-%.tar: dockerfiles/build/binaries/gitlab-runner-helper.%
@mkdir -p $$(dirname $@_)
docker build -t gitlab/gitlab-runner-helper:$*-$(REVISION) -f dockerfiles/build/Dockerfile.$* dockerfiles/build
-docker rm -f gitlab-runner-prebuilt-$*-$(REVISION)
docker create --name=gitlab-runner-prebuilt-$*-$(REVISION) gitlab/gitlab-runner-helper:$*-$(REVISION) /bin/sh
docker export -o $@ gitlab-runner-prebuilt-$*-$(REVISION)
docker rm -f gitlab-runner-prebuilt-$*-$(REVISION)
......@@ -69,8 +69,8 @@ release_docker_helper_images() {
helper_image_arm="gitlab/gitlab-runner-helper:arm-${REVISION}"
helper_image_arm_latest="gitlab/gitlab-runner-helper:arm-latest"
import out/helper-images/prebuilt-linux_x86_64.tar.xz ${helper_image_x86_64}
import out/helper-images/prebuilt-linux_arm.tar.xz ${helper_image_arm}
import out/helper-images/prebuilt-x86_64.tar.xz ${helper_image_x86_64}
import out/helper-images/prebuilt-arm.tar.xz ${helper_image_arm}
tag_latest ${helper_image_x86_64} ${helper_image_x86_64_latest}
tag_latest ${helper_image_arm} ${helper_image_arm_latest}
......
......@@ -6,6 +6,6 @@ RUN apk add --no-cache bash ca-certificates git git-lfs miniperl \
RUN git lfs install
COPY ./scripts/ /usr/bin
COPY ./binaries/gitlab-runner-helper.linux_arm /usr/bin/gitlab-runner-helper
COPY ./binaries/gitlab-runner-helper.arm /usr/bin/gitlab-runner-helper
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
......@@ -6,6 +6,6 @@ RUN apk add --no-cache bash ca-certificates git git-lfs miniperl \
RUN git lfs install
COPY ./scripts/ /usr/bin
COPY ./binaries/gitlab-runner-helper.linux_x86_64 /usr/bin/gitlab-runner-helper
COPY ./binaries/gitlab-runner-helper.x86_64 /usr/bin/gitlab-runner-helper
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment