Skip to content

Commit

Permalink
Build containerd and runc deb packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ernoaapa committed Apr 15, 2018
1 parent 1e4d8e7 commit 6c3592b
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 53 deletions.
26 changes: 26 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
steps:
- label: Go version
command: go version

- label: Docker version
command: docker version

- label: Install tools
command:
- GOPATH=~/go ./deps/install-build-tools.sh

- wait

- label: Build containerd arm64 deb package
command:
- rm -r dist
- GOOS=linux GOARCH=arm64 ./deps/build-containerd-deb.sh
- pkgcloud-push ernoaapa/containerd/raspbian/stretch dist/containerd_*_linux_arm64.deb || echo "Upload failed. Already uploaded?"

- wait

- label: Build runc arm64 deb package
command:
- rm -r dist
- GOOS=linux GOARCH=arm64 ./deps/build-runc-deb.sh
- pkgcloud-push ernoaapa/runc/raspbian/stretch dist/runc_*_linux_arm64.deb || echo "Upload failed. Already uploaded?"
36 changes: 25 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,7 @@ jobs:
name: Install tools
command: |
go get github.com/goreleaser/goreleaser
# Switch to fixed fork
cd /go/src/github.com/goreleaser/goreleaser
git remote add ernoaapa https://github.com/ernoaapa/goreleaser.git
git fetch ernoaapa
git checkout fix-arm-architecture
GOBIN=/go/bin go install .
go get github.com/mlafeldt/pkgcloud/...
- run: sudo apt-get update && sudo apt-get install -y btrfs-tools libseccomp-dev
- run: ./build/build-containerd-and-runc.sh
- run: goreleaser --snapshot
- run:
name: Publish Linux packages
Expand All @@ -67,8 +58,6 @@ jobs:
go get github.com/estesp/manifest-tool
go get github.com/mlafeldt/pkgcloud/...
- run: sudo apt-get update && sudo apt-get install -y btrfs-tools libseccomp-dev
- run: ./build/build-containerd-and-runc.sh
- run: goreleaser
- run: .circleci/scripts/push-docker-manifest.sh $(git describe --tags --always --dirty)
- run:
Expand All @@ -79,8 +68,33 @@ jobs:
pkgcloud-push ernoaapa/eliot/raspbian/stretch dist/eliot_*_linux_armv6.deb
pkgcloud-push ernoaapa/eliot/raspbian/stretch dist/eliot_*_linux_armv7.deb
deps_build_and_release:
<<: *defaults
steps:
- checkout

- run:
name: Install build dependencies
command: sudo apt-get update && sudo apt-get install -y btrfs-tools libseccomp-dev
- run: ./deps/install-build-tools.sh
- run:
name: build & release containerd
command: |
GOOS=linux GOARCH=amd64 ./deps/build-containerd-deb.sh
pkgcloud-push ernoaapa/containerd/raspbian/stretch dist/containerd_*_linux_amd64.deb || echo "Upload failed. Already uploaded?"
- run:
name: build & release runc
command: |
GOOS=linux GOARCH=amd64 ./deps/build-runc-deb.sh
pkgcloud-push ernoaapa/runc/raspbian/stretch dist/runc_*_linux_amd64.deb || echo "Upload failed. Already uploaded?"
workflows:
version: 2
deps:
jobs:
- deps_build_and_release

build_and_test:
jobs:
- test:
Expand Down
10 changes: 1 addition & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,8 @@ nfpm:
formats:
- deb

# At the moment repositories includes really old version of containerd
# so we bake in the containerd daemon and runc binary
# dependencies:
# - [email protected]
dependencies:
- libseccomp2 #(Actually runc dep)
- [email protected]

files:
"build/etc/systemd/system/eliotd.service": "/etc/systemd/system/eliotd.service"
"build/etc/systemd/system/containerd.service": "/etc/systemd/system/containerd.service"
# Built during the build process
"bin/runc": "/usr/local/bin/runc"
"bin/containerd": "/usr/local/bin/containerd"
33 changes: 0 additions & 33 deletions build/build-containerd-and-runc.sh

This file was deleted.

3 changes: 3 additions & 0 deletions deps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DEPS

This directory contains all scripts to build containerd and runc dependencies
45 changes: 45 additions & 0 deletions deps/build-containerd-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh
#
#

set -eu

CONTAINERD_VERSION="v1.0.3"
BUILD_DIR=/tmp/build
ELIOT_SRC_DIR=$(pwd)
TARGET_DIR=${ELIOT_SRC_DIR}/dist

mkdir -p $TARGET_DIR

rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR}/src/github.com/containerd/containerd
wget -qO- "https://github.com/containerd/containerd/archive/${CONTAINERD_VERSION}.tar.gz" | tar xvz --strip-components=1 -C ${BUILD_DIR}/src/github.com/containerd/containerd
cd ${BUILD_DIR}/src/github.com/containerd/containerd
# Modify Makefile to have optional VERSION and REVISION
sed -i='' 's/VERSION=/VERSION?=/g' Makefile
sed -i='' 's/REVISION=/REVISION?=/g' Makefile

echo "Compile containerd os:${GOOS}, arch:${GOARCH}, variant:${GOARM:-""}"
GOPATH=${BUILD_DIR} VERSION=${CONTAINERD_VERSION} REVISION=unknown make binaries

cat << EOF > ./nfpm.yaml
name: "containerd"
arch: "${GOARCH}${GOARM:-""}"
platform: "${GOOS}"
version: "${CONTAINERD_VERSION}"
section: "default"
priority: "extra"
depends:
- [email protected]
maintainer: "Erno Aapa <[email protected]>"
description: An open and reliable container runtime
homepage: "https://containerd.io"
license: "Apache 2.0"
bindir: "/usr/local/bin"
files:
./bin/containerd: "/usr/local/bin/containerd"
./bin/ctr: "/usr/local/bin/ctr"
./bin/containerd-shim: "/usr/local/bin/containerd-shim"
${ELIOT_SRC_DIR}/build/etc/systemd/system/containerd.service: "/etc/systemd/system/containerd.service"
EOF

nfpm pkg --target ${TARGET_DIR}/containerd_${CONTAINERD_VERSION}_${GOOS}_${GOARCH}${GOARM:-""}.deb
38 changes: 38 additions & 0 deletions deps/build-runc-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
#
#

set -eu

RUNC_VERSION="v0.1.1"
BUILD_DIR=/tmp/build
TARGET_DIR=$(pwd)/dist

mkdir -p $TARGET_DIR

rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR}/src/github.com/opencontainers/runc
wget -qO- "https://github.com/opencontainers/runc/archive/${RUNC_VERSION}.tar.gz" | tar xvz --strip-components=1 -C ${BUILD_DIR}/src/github.com/opencontainers/runc
cd ${BUILD_DIR}/src/github.com/opencontainers/runc

echo "Build runc os:${GOOS}, arch:${GOARCH}, variant:${GOARM:-""}"
GOPATH=${BUILD_DIR} make

cat << EOF > ./nfpm.yaml
name: "runc"
arch: "${GOARCH}${GOARM:-""}"
platform: "${GOOS}"
version: "${RUNC_VERSION}"
section: "default"
priority: "extra"
depends:
- libseccomp2
maintainer: "Erno Aapa <[email protected]>"
description: runc is a CLI tool for spawning and running containers according to the OCI specification.
homepage: "https://www.opencontainers.org"
license: "Apache 2.0"
bindir: "/usr/local/bin"
files:
./runc: "/usr/local/bin/runc"
EOF

nfpm pkg --target ${TARGET_DIR}/runc_${RUNC_VERSION}_${GOOS}_${GOARCH}${GOARM:-""}.deb
21 changes: 21 additions & 0 deletions deps/install-build-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -eu

go get -u github.com/goreleaser/goreleaser
# Switch to fixed fork
cd $GOPATH/src/github.com/goreleaser/goreleaser
git remote add ernoaapa https://github.com/ernoaapa/goreleaser.git || true
git fetch ernoaapa
git checkout fix-arm-architecture
GOBIN=$GOPATH/bin go install .

go get -u github.com/goreleaser/nfpm
# Switch to fixed fork
cd $GOPATH/src/github.com/goreleaser/nfpm
git remote add ernoaapa https://github.com/ernoaapa/nfpm.git || true
git fetch ernoaapa
git checkout fix-arm-architecture
GOBIN=$GOPATH/bin go install ./cmd/nfpm/

go get github.com/mlafeldt/pkgcloud/...

0 comments on commit 6c3592b

Please sign in to comment.