Skip to content

Commit

Permalink
Try podman build
Browse files Browse the repository at this point in the history
  • Loading branch information
eMGabriel committed May 25, 2020
1 parent 185ef5d commit 97c3738
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 23 deletions.
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
sudo: required
dist: xenial

env:
- USE_CACHE=true TRAVIS_PIPELINE=docker
- USE_CACHE=true TRAVIS_PIPELINE=buildah BUILDAH_LAYERS=true
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}" == "buildah" ]] && ./.travis/install_buildah.sh
- [[ "${TRAVIS_PIPELINE}" == "podman" ]] && ./.travis/install_podman.sh

install:
- [[ "${TRAVIS_PIPELINE}" == "buildah" ]] && ./.travis/install_buildah.sh
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls

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

0 comments on commit 97c3738

Please sign in to comment.