Skip to content

Commit

Permalink
Get ARM CI working
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Feb 5, 2019
1 parent 84756df commit ce11c0f
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 55 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
./bin
./build
./build/data
./build/data.tar.gz
./pkg/data/zz_generated_bindata.go
./package/data.tar.gz
./.vagrant
Expand Down
228 changes: 189 additions & 39 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,221 @@
---
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
- name: docker
host:
path: /var/run/docker.sock

---
kind: pipeline
name: arm
name: arm64

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
- 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: arm64
name: manifest

platform:
os: linux
arch: arm64
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: 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

volumes:
- name: docker
host:
path: /var/run/docker.sock
depends_on:
- amd64
- arm64
- arm
2 changes: 1 addition & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
14 changes: 7 additions & 7 deletions scripts/package-cli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
8 changes: 2 additions & 6 deletions scripts/package-image
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit ce11c0f

Please sign in to comment.