Get ARM CI working

This commit is contained in:
Darren Shepherd 2019-02-04 21:42:35 -07:00
parent 84756df8a2
commit ce11c0f6f3
6 changed files with 211 additions and 64 deletions

View File

@ -1,5 +1,6 @@
./bin
./build
./build/data
./build/data.tar.gz
./pkg/data/zz_generated_bindata.go
./package/data.tar.gz
./.vagrant

View File

@ -1,51 +1,64 @@
---
kind: pipeline
name: intel
name: amd64
platform:
os: linux
arch: amd64
steps:
- name: build
privileged: true
image: rancher/dapper:v0.4.0
volumes:
- name: docker
path: /var/run/docker.sock
commands:
- dapper ci
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-amd64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "ibuildthecloud/k3s"
tag: "${DRONE_TAG}-amd64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: arm
platform:
os: linux
arch: arm64
steps:
- name: build
privileged: true
image: rancher/dapper:v0.4.0
environment:
DAPPER_HOST_ARCH: arm
volumes:
- name: docker
path: /var/run/docker.sock
commands:
- dapper ci
volumes:
- name: docker
host:
path: /var/run/docker.sock
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
@ -56,16 +69,153 @@ platform:
arch: arm64
steps:
- name: build
privileged: true
image: rancher/dapper:v0.4.0
volumes:
- name: docker
path: /var/run/docker.sock
commands:
- dapper ci
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "ibuildthecloud/k3s"
tag: "${DRONE_TAG}-arm64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: arm
platform:
os: linux
arch: arm
steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
host:
path: /var/run/docker.sock
path: /var/run/docker.sock
- name: github_binary_release
image: ibuildthecloud/github-release:v0.0.1
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "ibuildthecloud/k3s"
tag: "${DRONE_TAG}-arm"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock
---
kind: pipeline
name: manifest
platform:
os: linux
arch: amd64
steps:
- name: manifest
image: plugins/manifest:1.0.2
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
platforms:
- linux/amd64
- linux/arm64
- linux/arm
target: "ibuildthecloud/k3s:${DRONE_TAG}"
template: "ibuildthecloud/k3s:${DRONE_TAG}-ARCH"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag
depends_on:
- amd64
- arm64
- arm

View File

@ -19,7 +19,7 @@ ENV ARCH $DAPPER_HOST_ARCH
ENV DAPPER_RUN_ARGS --privileged
ENV DAPPER_ENV REPO TAG DRONE_TAG IMAGE_NAME
ENV DAPPER_SOURCE /go/src/github.com/rancher/k3s/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_OUTPUT ./bin ./dist ./build/out/
ENV DAPPER_DOCKER_SOCKET true
ENV HOME ${DAPPER_SOURCE}
ENV CROSS true

View File

@ -1,6 +1,6 @@
FROM alpine:3.8 as base
RUN apk add -U ca-certificates
ADD data.tar.gz /image
ADD build/out/data.tar.gz /image
RUN mkdir -p /image/etc/ssl/certs /image/run /image/var/run /image/tmp /image/lib/modules /image/lib/firmware && \
cp /etc/ssl/certs/ca-certificates.crt /image/etc/ssl/certs/ca-certificates.crt
RUN cd image/bin && \

View File

@ -20,13 +20,13 @@ done
rm -rf build/data
mkdir -p build/data
mkdir -p dist
mkdir -p build/data build/out
mkdir -p dist/artifacts
tar cvzf ./build/data.tar.gz --exclude ./bin/hyperkube ./bin
HASH=$(sha256sum ./build/data.tar.gz | awk '{print $1}')
tar cvzf ./build/out/data.tar.gz --exclude ./bin/hyperkube ./bin
HASH=$(sha256sum ./build/out/data.tar.gz | awk '{print $1}')
cp ./build/data.tar.gz ./build/data/${HASH}.tgz
cp ./build/out/data.tar.gz ./build/data/${HASH}.tgz
BIN_SUFFIX="-${ARCH}"
if [ ${ARCH} = amd64 ]; then
@ -35,8 +35,8 @@ elif [ ${ARCH} = arm ]; then
BIN_SUFFIX="-armhf"
fi
cp -f ./bin/hyperkube dist/hyperkube${BIN_SUFFIX}
CMD_NAME=dist/k3s${BIN_SUFFIX}
cp -f ./bin/hyperkube dist/artifacts/hyperkube${BIN_SUFFIX}
CMD_NAME=dist/artifacts/k3s${BIN_SUFFIX}
go generate
LDFLAGS="-X github.com/rancher/k3s/version.Version=$VERSION -w -s"

View File

@ -3,16 +3,12 @@ set -e
source $(dirname $0)/version.sh
cd $(dirname $0)/../package
cd $(dirname $0)/..
TAG=${TAG:-${VERSION}${SUFFIX}}
REPO=${REPO:-rancher}
IMAGE_NAME=${IMAGE_NAME:-k3s}
cp -f ../build/data.tar.gz .
IMAGE=${REPO}/${IMAGE_NAME}:${TAG}
docker build -t ${IMAGE} .
mkdir -p ../dist
echo ${IMAGE} > ../dist/images
docker build -t ${IMAGE} -f package/Dockerfile .
echo Built ${IMAGE}