Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build pipeline with buildah #202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ dist: xenial
arch:
- arm64
- amd64
env:
- TRAVIS_PIPELINE=docker
## TODO: figure out why buildah pipeline is flaky, even with sudo
## - TRAVIS_PIPELINE=buildah
services: docker

language: go

go:
- 1.13.x

services: docker
env:
- USE_CACHE=true TRAVIS_PIPELINE=docker
- USE_CACHE=true TRAVIS_PIPELINE=podman
# - USE_CACHE=true TRAVIS_PIPELINE=buildah

before_install:
- [[ "${TRAVIS_PIPELINE}" == "podman" ]] && ./.travis/install_podman.sh
# - [[ "${TRAVIS_PIPELINE}" == "buildah" ]] && ./.travis/install_buildah.sh

install:
- go get golang.org/x/tools/cmd/cover
Expand Down
26 changes: 13 additions & 13 deletions .travis/install_buildah.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y ppa:alexlarsson/flatpak
sudo add-apt-repository -y ppa:gophers/archive
sudo apt-add-repository -y ppa:projectatomic/ppa
sudo apt-get -y -qq update
sudo apt-get -y install bats btrfs-tools git libapparmor-dev libdevmapper-dev libglib2.0-dev libgpgme11-dev libostree-dev libseccomp-dev libselinux1-dev skopeo-containers go-md2man
mkdir -p "$GOPATH/src/github.com/containers/buildah"
git clone https://github.com/containers/buildah "$GOPATH/src/github.com/containers/buildah"
cd "$GOPATH/src/github.com/containers/buildah" || exit
make runc all SECURITYTAGS="apparmor seccomp"
sudo make install install.runc
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y ppa:alexlarsson/flatpak
sudo add-apt-repository -y ppa:gophers/archive
sudo apt-add-repository -y ppa:projectatomic/ppa
sudo apt-get -y -qq update
sudo apt-get -y install runc buildah

# Hack podman's configuration files.
# /etc/containers/registries.conf does not exist.
# https://clouding.io/kb/en/how-to-install-and-use-podman-on-ubuntu-18-04/
ls -1 /etc/containers/registries.conf || true
sudo mkdir -p /etc/containers

sudo tee -a /etc/containers/registries.conf >/dev/null <<-'EOF'
[registries.search]
registries = ['docker.io', 'registry.fedoraproject.org', 'quay.io', 'registry.access.redhat.com', 'registry.centos.org']
Expand Down
52 changes: 52 additions & 0 deletions .travis/install_podman.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

setup () {
# https://github.com/containers/libpod/blob/master/install.md#ubuntu
echo travis_fold:start:install_podman
sudo apt-get update -qq
sudo apt-get install -qq -y software-properties-common uidmap
sudo add-apt-repository -y ppa:projectatomic/ppa
sudo apt-get update -qq
sudo apt-get -qq -y install podman
echo travis_fold:end:install_podman
}

verify () {
# Show version and info.
echo travis_fold:start:verify_podman
podman --version
podman version
podman info --debug
apt-cache show podman
dpkg-query -L podman
echo travis_fold:end:verify_podman
}

configure () {
echo travis_fold:start:configure_podman
# Hack podman's configuration files.
# /etc/containers/registries.conf does not exist.
# https://clouding.io/kb/en/how-to-install-and-use-podman-on-ubuntu-18-04/
ls -1 /etc/containers/registries.conf || true
sudo mkdir -p /etc/containers

sudo tee -a /etc/containers/registries.conf >/dev/null <<-'EOF'
[registries.search]
registries = ['docker.io', 'registry.fedoraproject.org', 'quay.io', 'registry.access.redhat.com', 'registry.centos.org']

[registries.insecure]
registries = []

[registries.block]
registries = []

EOF
echo travis_fold:end:configure_podman
}

main () {

}


main
10 changes: 5 additions & 5 deletions build_danm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ fi
#
# Identify if we need to run docker or buildah
#
if [[ ( "$TRAVIS_PIPELINE" = "buildah" ) || ( "$TRAVIS_PIPELINE" = "" && -x "$(command -v buildah)" ) ]]
if [[ ( "$TRAVIS_PIPELINE" = "podman" ) || ( "$TRAVIS_PIPELINE" = "" && -x "$(command -v podman)" ) ]]
then
BUILD_COMMAND="buildah bud"
TAG_COMMAND="buildah tag"
PUSH_COMMAND="buildah push"
BUILD_COMMAND="podman image build"
TAG_COMMAND="podman image tag"
PUSH_COMMAND="podman push"
elif [[ ( "$TRAVIS_PIPELINE" = "docker" ) || ( "$TRAVIS_PIPELINE" = "" && -x "$(command -v docker)" ) ]]
then
BUILD_COMMAND="docker image build"
Expand Down Expand Up @@ -116,7 +116,7 @@ fi
#
for plugin in ${build_targets[@]}
do
echo Building: ${plugin}, version ${COMMIT_HASH}
echo "Building: ${plugin}, version ${COMMIT_HASH}"
${BUILD_COMMAND} \
${EXTRA_BUILD_ARGS} \
${FIRST_BUILD_EXTRA_BUILD_ARGS} \
Expand Down