buildkite / feedback

Got feedback? Please let us know!
https://buildkite.com
25 stars 24 forks source link

Add an alpine package for the buildkite agent #144

Open mbj opened 8 years ago

mbj commented 8 years ago

In the current situation when the agents environment on alpine needs to be customized the customization has to be done on top of the buildkite/agent:latest image.

When the customization goes very deep, some setup that is specific to this docker image needs to be un-done first (like setting USER root to perform some privileged operations).

To ease the use of the agent in an alpine env, I propose to create a package overlay (and maybe get it later into an official alpine package) that contains the agent as an apline package.

This fixes various issues:

Reference discussion in the Slack channel:

https://buildkitechat.slack.com/archives/docker/p1453771611000002

I did an example APK package + build environment in this repository:

Feel free to use this build environment and the APKBUILD file as a template to manage your official package overlay. Make sure you remove traces from my work like the alpine-packages S3 buckets (bucket names are global) and my name from from the packages metadata.

ineffyble commented 7 years ago

I came to suggest the exact same thing.

It would be neat, and it's a better method than doing something like mounting the agent binary on the Docker host to the container.

sj26 commented 6 years ago

I'd love us to publish a package!

@mbj I went looking for your package but it looks like the repository no longer exists? We don't have any experience creating or distributing alpine packages, so some assistance would be appreciated.

Ideally we'd like to package up our officially compiled releases as an alpine package and distribute them from our own repository, something like https://apk.buildkite.com. It looks like this is all possible, but I'm not super familiar with how APKBUILDs work — does anybody have a working package build for buildkite-agent?

lox commented 6 years ago

I started to look at this a while back, would love it too!

mbj commented 6 years ago

@mbj I went looking for your package but it looks like the repository no longer exists? We don't have any experience creating or distributing alpine packages, so some assistance would be appreciated.

Heh, I recently GCed my repositories, and the one with the package felt victim to it. Let me look if I still have it somewhere.

mbj commented 6 years ago

So the APKBUILD was:

# Contributor: Markus Schirp <mbj@schirp-dso.com>
# Maintainer: Markus Schirp <mbj@schirp-dso.com>
pkgname=buildkite-agent
pkgver=2.1.4
pkgrel=0
pkgdesc="Buildkite Agent"
url="buildkite.com"
arch="x86_64"
license="MIT"
depends="openssh-client git perl"
install="$pkgname.pre-install"
subpackages=""
source="https://github.com/buildkite/agent/releases/download/v2.1.4/buildkite-agent-linux-386-2.1.4.tar.gz"

prepare() {
        cd $srcdir
}

build() {
        cd $srcdir
}

package() {
        cd $srcdir
        install -Dm755 "buildkite-agent"     "$pkgdir/usr/bin/buildkite-agent"
        install -Dm755 "bootstrap.sh"        "$pkgdir/usr/lib/buildkite/bootstrap.sh"
        install -Dm755 "buildkite-agent.cfg" "$pkgdir/etc/buildkite-agent.cfg"
}

md5sums="eac7ef91ff6004e771bcfa150041f2ab  buildkite-agent-linux-386-2.1.4.tar.gz"
sha256sums="9126faf1edf6eaab2fa1a90bc1f4ce4d634adf696c9af18af39829bfc166cc5e  buildkite-agent-linux-386-2.1.4.tar.gz"
sha512sums="e745cd5f2637e3b65abc61ed7fc389b72fce07f0498c11f939165bc0634d773ebcfb97bb0cd5d5f1d555aa78353d0bb1bbfcdfa0731e3f4f152072128987cac5  buildkite-agent-linux-386-2.1.4.tar.gz"

And the buildkite-agent.pre-install was:

#!/bin/sh
exec adduser -D -h /var/buildkite buildkite

Note that this is untested as of right now, I did this back in 2016, and moved on to a different solution meanwhile.