Cirrus: Migrate off papr + implement VM testing
Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
parent
8869618456
commit
90868620d4
177
.cirrus.yml
177
.cirrus.yml
|
@ -5,24 +5,31 @@ env:
|
|||
####
|
||||
#### Global variables used for all tasks
|
||||
####
|
||||
GOPATH: "/var/tmp/go"
|
||||
GOSRC: "${GOPATH}/src/github.com/containers/buildah"
|
||||
# Overrides default location (/tmp/cirrus) for repo clone
|
||||
CIRRUS_WORKING_DIR: "/var/tmp/go/src/github.com/containers/buildah"
|
||||
CIRRUS_WORKING_DIR: "${GOSRC}"
|
||||
# Shell used to execute all script commands
|
||||
CIRRUS_SHELL: "/bin/bash"
|
||||
# Automation script path relative to $CIRRUS_WORKING_DIR)
|
||||
SCRIPT_BASE: "./contrib/cirrus"
|
||||
# No need to go crazy, but grab enough to cover most PRs
|
||||
CIRRUS_CLONE_DEPTH: 50
|
||||
# Unless set by in_podman.sh, default to operating outside of a podman container
|
||||
IN_PODMAN: 'false'
|
||||
# Not cross-compiling by default
|
||||
CROSS_TARGET: ""
|
||||
|
||||
####
|
||||
#### Cache-image names to test with
|
||||
####
|
||||
# GCE project where images live
|
||||
IMAGE_PROJECT: "libpod-218412"
|
||||
# TODO: Setting up from base-images is very inefficient, use libpod's cache-images instead?
|
||||
FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-30-1-2-1565360543"
|
||||
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-29-1-2-1565360543"
|
||||
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1904-disco-v20190724" # Latest
|
||||
PRIOR_UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1804-bionic-v20190722a" # LTS
|
||||
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1904-disco-v20190724"
|
||||
PRIOR_UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1804-bionic-v20190722a"
|
||||
|
||||
####
|
||||
#### Command variables to help avoid duplication
|
||||
|
@ -50,62 +57,9 @@ gce_instance:
|
|||
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
|
||||
|
||||
|
||||
testing_task:
|
||||
gce_instance: # Only need to specify differences from defaults (above)
|
||||
matrix: # Duplicate this task for each matrix product.
|
||||
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
|
||||
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
|
||||
image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
|
||||
image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}"
|
||||
|
||||
# Separate scripts for separate outputs, makes debugging easier.
|
||||
setup_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
|
||||
build_and_test_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/build_and_test.sh |& ${_TIMESTAMP}'
|
||||
|
||||
# Log collection when job was successful
|
||||
df_script: '${_DFCMD} || true'
|
||||
rh_audit_log_script: '${_RAUDITCMD} || true'
|
||||
ubuntu_audit_log_script: '${_UAUDITCMD} || true'
|
||||
journal_log_script: '${_JOURNALCMD} || true'
|
||||
|
||||
on_failure: # Script names must be different from above
|
||||
failure_df_script: '${_DFCMD} || true'
|
||||
failure_rh_audit_log_script: '${_RAUDITCMD} || true'
|
||||
failure_ubuntu_audit_log_script: '${_UAUDITCMD} || true'
|
||||
failure_journal_log_script: '${_JOURNALCMD} || true'
|
||||
|
||||
|
||||
# This task runs `make vendor` followed by ./hack/tree_status.sh to check
|
||||
# whether the git tree is clean. The reasoning for that is to make sure
|
||||
# that the vendor.conf, the code and the vendored packages in ./vendor are
|
||||
# in sync at all times.
|
||||
vendor_task:
|
||||
|
||||
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\*\*\*\s*CIRRUS:\s*TEST\s*IMAGES\s*\*\*\*.*'
|
||||
|
||||
env:
|
||||
CIRRUS_WORKING_DIR: "/var/tmp/go/src/github.com/containers/buildah"
|
||||
GOPATH: "/go"
|
||||
GOSRC: "/go/src/github.com/containers/buildah"
|
||||
|
||||
# Runs within Cirrus's "community cluster"
|
||||
container:
|
||||
image: docker.io/library/golang:1.13
|
||||
cpu: 1
|
||||
memory: 1
|
||||
|
||||
timeout_in: 30m
|
||||
|
||||
vendor_script:
|
||||
- 'cd ${CIRRUS_WORKING_DIR} && make vendor'
|
||||
- 'cd ${CIRRUS_WORKING_DIR} && ./hack/tree_status.sh'
|
||||
|
||||
# Update metadata on VM images referenced by this repository state
|
||||
meta_task:
|
||||
|
||||
depends_on:
|
||||
- "vendor"
|
||||
|
||||
container:
|
||||
image: "quay.io/libpod/imgts:latest" # see contrib/imgts
|
||||
cpu: 1
|
||||
|
@ -126,3 +80,114 @@ meta_task:
|
|||
CIRRUS_CLONE_DEPTH: 1 # source not used
|
||||
|
||||
script: '/usr/local/bin/entrypoint.sh |& ${_TIMESTAMP}'
|
||||
|
||||
|
||||
gate_task:
|
||||
|
||||
timeout_in: 20m
|
||||
|
||||
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
|
||||
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
|
||||
validate_test_script: '${SCRIPT_BASE}/test.sh validate |& ${_TIMESTAMP}'
|
||||
# FIXME: some tests broken
|
||||
# unit_test_script: '${SCRIPT_BASE}/test.sh unit |& ${_TIMESTAMP}'
|
||||
|
||||
binary_artifacts:
|
||||
path: ./bin/*
|
||||
|
||||
|
||||
# This task runs `make vendor` followed by ./hack/tree_status.sh to check
|
||||
# whether the git tree is clean. The reasoning for that is to make sure
|
||||
# that the vendor.conf, the code and the vendored packages in ./vendor are
|
||||
# in sync at all times.
|
||||
vendor_task:
|
||||
|
||||
env:
|
||||
CIRRUS_WORKING_DIR: "/var/tmp/go/src/github.com/containers/buildah"
|
||||
GOPATH: "/var/tmp/go"
|
||||
GOSRC: "/var/tmp/go/src/github.com/containers/buildah"
|
||||
|
||||
# Runs within Cirrus's "community cluster"
|
||||
container:
|
||||
image: docker.io/library/golang:1.13
|
||||
cpu: 1
|
||||
memory: 1
|
||||
|
||||
timeout_in: 5m
|
||||
|
||||
vendor_script:
|
||||
- 'make vendor'
|
||||
- './hack/tree_status.sh'
|
||||
|
||||
|
||||
cross_task:
|
||||
|
||||
depends_on:
|
||||
- gate
|
||||
- vendor
|
||||
|
||||
container:
|
||||
image: registry.fedoraproject.org/fedora:30
|
||||
|
||||
env:
|
||||
matrix:
|
||||
CROSS_TARGET: darwin
|
||||
|
||||
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
|
||||
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
|
||||
|
||||
binary_artifacts:
|
||||
path: ./bin/*
|
||||
|
||||
|
||||
testing_task:
|
||||
|
||||
depends_on:
|
||||
- gate
|
||||
- vendor
|
||||
|
||||
gce_instance: # Only need to specify differences from defaults (above)
|
||||
matrix: # Duplicate this task for each matrix product.
|
||||
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
|
||||
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
|
||||
image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
|
||||
image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}"
|
||||
|
||||
# Separate scripts for separate outputs, makes debugging easier.
|
||||
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
|
||||
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
|
||||
integration_test_script: '${SCRIPT_BASE}/test.sh integration |& ${_TIMESTAMP}'
|
||||
|
||||
binary_artifacts:
|
||||
path: ./bin/*
|
||||
|
||||
always: &standardlogs
|
||||
df_script: '${_DFCMD} || true'
|
||||
rh_audit_log_script: '${_RAUDITCMD} || true'
|
||||
ubuntu_audit_log_script: '${_UAUDITCMD} || true'
|
||||
journal_log_script: '${_JOURNALCMD} || true'
|
||||
|
||||
|
||||
testing_in_podman_task:
|
||||
|
||||
depends_on:
|
||||
- gate
|
||||
- vendor
|
||||
|
||||
env:
|
||||
# This is key, it causes the scripts to re-execute themselves inside a container.
|
||||
IN_PODMAN: 'true'
|
||||
BUILDAH_ISOLATION: 'chroot'
|
||||
STORAGE_DRIVER: 'vfs'
|
||||
STORAGE_OPTIONS: ''
|
||||
|
||||
# Separate scripts for separate outputs, makes debugging easier.
|
||||
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
|
||||
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
|
||||
integration_test_script: '${SCRIPT_BASE}/test.sh integration |& ${_TIMESTAMP}'
|
||||
|
||||
binary_artifacts:
|
||||
path: ./bin/*
|
||||
|
||||
always:
|
||||
<<: *standardlogs
|
||||
|
|
42
.papr.sh
42
.papr.sh
|
@ -1,42 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -xeuo pipefail
|
||||
export GOPATH=/go
|
||||
export PATH=$HOME/gopath/bin:$PATH:$GOPATH/bin
|
||||
export GOSRC=$GOPATH/src/github.com/containers/buildah
|
||||
|
||||
cp -fv /etc/yum.repos.d{.host/*.repo,}
|
||||
|
||||
dnf install -y \
|
||||
bats \
|
||||
btrfs-progs-devel \
|
||||
bzip2 \
|
||||
device-mapper-devel \
|
||||
findutils \
|
||||
git \
|
||||
glib2-devel \
|
||||
glibc-static \
|
||||
gnupg \
|
||||
golang \
|
||||
gpgme-devel \
|
||||
libassuan-devel \
|
||||
libseccomp-devel \
|
||||
libselinux-devel \
|
||||
libselinux-static \
|
||||
libseccomp-static \
|
||||
libselinux-utils \
|
||||
make \
|
||||
openssl \
|
||||
skopeo-containers \
|
||||
which
|
||||
|
||||
|
||||
# Install gomega
|
||||
go get github.com/onsi/gomega/...
|
||||
|
||||
# PAPR adds a merge commit, for testing, which fails the
|
||||
# short-commit-subject validation test, so tell git-validate.sh to only check
|
||||
# up to, but not including, the merge commit.
|
||||
export GITVALIDATE_TIP=$(cd $GOSRC; git log -2 --pretty='%H' | tail -n 1)
|
||||
make -C $GOSRC install.tools runc all validate test-unit test-integration static
|
||||
env BUILDAH_ISOLATION=chroot make -C $GOSRC test-integration
|
||||
env BUILDAH_ISOLATION=rootless make -C $GOSRC test-integration
|
87
.papr.yml
87
.papr.yml
|
@ -1,87 +0,0 @@
|
|||
branches:
|
||||
- master
|
||||
- auto
|
||||
- try
|
||||
|
||||
host:
|
||||
# 29 is the highest level of atomic
|
||||
distro: fedora/29/atomic
|
||||
|
||||
required: true
|
||||
|
||||
tests:
|
||||
# Let's create a self signed certificate and get it in the right places
|
||||
- hostname
|
||||
- ip a
|
||||
- ping -c 3 localhost
|
||||
- cat /etc/hostname
|
||||
- mkdir -p /home/travis/auth
|
||||
- openssl req -newkey rsa:4096 -nodes -sha256 -keyout /home/travis/auth/domain.key -x509 -days 2 -out /home/travis/auth/domain.crt -subj "/C=US/ST=Foo/L=Bar/O=Red Hat, Inc./CN=localhost"
|
||||
- cp /home/travis/auth/domain.crt /home/travis/auth/domain.cert
|
||||
- sudo mkdir -p /etc/docker/certs.d/docker.io/
|
||||
- sudo cp /home/travis/auth/domain.crt /etc/docker/certs.d/docker.io/ca.crt
|
||||
- sudo mkdir -p /etc/docker/certs.d/localhost:5000/
|
||||
- sudo cp /home/travis/auth/domain.crt /etc/docker/certs.d/localhost:5000/ca.crt
|
||||
- sudo cp /home/travis/auth/domain.crt /etc/docker/certs.d/localhost:5000/domain.crt
|
||||
# Create the credentials file, then start up the Docker registry
|
||||
- podman run --entrypoint htpasswd registry:2 -Bbn testuser testpassword > /home/travis/auth/htpasswd
|
||||
- podman run -d -p 5000:5000 --name registry -v /home/travis/auth:/home/travis/auth:Z -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/home/travis/auth/htpasswd -e REGISTRY_HTTP_TLS_CERTIFICATE=/home/travis/auth/domain.crt -e REGISTRY_HTTP_TLS_KEY=/home/travis/auth/domain.key registry:2
|
||||
|
||||
# Test Podman setup
|
||||
- podman version
|
||||
- podman info
|
||||
- podman ps --all
|
||||
- podman images
|
||||
- ls -alF /home/travis/auth
|
||||
- podman pull alpine
|
||||
- podman login localhost:5000 --username testuser --password testpassword
|
||||
- podman tag alpine localhost:5000/my-alpine
|
||||
- podman push --creds=testuser:testpassword localhost:5000/my-alpine
|
||||
- podman ps --all
|
||||
- podman images
|
||||
- podman rmi docker.io/alpine
|
||||
- podman rmi localhost:5000/my-alpine
|
||||
- podman pull --creds=testuser:testpassword localhost:5000/my-alpine
|
||||
- podman ps --all
|
||||
- podman images
|
||||
- podman rmi localhost:5000/my-alpine
|
||||
|
||||
# mount yum repos to inherit injected mirrors from PAPR
|
||||
- podman run --net=host --security-opt label=disable --cap-add all --security-opt seccomp=unconfined -v /etc/yum.repos.d:/etc/yum.repos.d.host:ro
|
||||
-v $PWD:/go/src/github.com/containers/buildah
|
||||
--workdir /go/src/github.com/containers/buildah
|
||||
registry.fedoraproject.org/fedora:30 bash -c sh ./.papr.sh
|
||||
|
||||
---
|
||||
|
||||
container:
|
||||
image: registry.fedoraproject.org/fedora:30
|
||||
|
||||
packages:
|
||||
- btrfs-progs-devel
|
||||
- bzip2
|
||||
- device-mapper-devel
|
||||
- findutils
|
||||
- git
|
||||
- glib2-devel
|
||||
- gnupg
|
||||
- golang
|
||||
- libassuan-devel
|
||||
- make
|
||||
- skopeo-containers
|
||||
|
||||
required: false
|
||||
pulls: true
|
||||
|
||||
env:
|
||||
GOPATH: /go
|
||||
GOSRC: /go/src/github.com/containers
|
||||
|
||||
tests:
|
||||
- mkdir -p $GOSRC && ln -s /var/tmp/checkout $GOSRC/buildah
|
||||
- cd $GOSRC/buildah && make darwin
|
||||
|
||||
artifacts:
|
||||
- test-suite.log
|
||||
|
||||
context: "darwin CI"
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
source $(dirname $0)/lib.sh
|
||||
|
||||
req_env_var IN_PODMAN IN_PODMAN_NAME GOSRC
|
||||
|
||||
if [[ "$IN_PODMAN" == "true" ]]
|
||||
then
|
||||
cd $GOSRC
|
||||
in_podman --rm $IN_PODMAN_NAME $0
|
||||
else
|
||||
cd $GOSRC
|
||||
echo "Compiling buildah"
|
||||
showrun make $CROSS_TARGET ${CROSS_TARGET:+CGO_ENABLED=0}
|
||||
mkdir -p bin
|
||||
|
||||
echo "Installing buildah"
|
||||
if [[ -z "$CROSS_TARGET" ]]
|
||||
then
|
||||
ln -v buildah bin/buildah
|
||||
showrun make install PREFIX=/usr
|
||||
else
|
||||
ln -v buildah.${CROSS_TARGET} bin/buildah
|
||||
fi
|
||||
fi
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
source $(dirname $0)/lib.sh
|
||||
|
||||
cd $GOSRC
|
||||
showrun echo "testing stuffs"
|
|
@ -11,6 +11,8 @@ export USER="$(whoami)"
|
|||
export HOME="$(getent passwd $USER | cut -d : -f 6)"
|
||||
[[ -n "$UID" ]] || export UID=$(getent passwd $USER | cut -d : -f 3)
|
||||
export GID=$(getent passwd $USER | cut -d : -f 4)
|
||||
# Not cross-compiling by default
|
||||
CROSS_TARGET="${CROSS_TARGET:-}"
|
||||
|
||||
# Essential default paths, many are overridden when executing under Cirrus-CI
|
||||
# others are duplicated here, to assist in debugging.
|
||||
|
@ -56,15 +58,25 @@ OS_RELEASE_VER="$(source /etc/os-release; echo $VERSION_ID | cut -d '.' -f 1)"
|
|||
# Combined to ease soe usage
|
||||
OS_REL_VER="${OS_RELEASE_ID}-${OS_RELEASE_VER}"
|
||||
|
||||
# for in-container testing
|
||||
IN_PODMAN_IMAGE="$OS_RELEASE_ID:$OS_RELEASE_VER"
|
||||
IN_PODMAN_NAME="in_podman_$CIRRUS_TASK_ID"
|
||||
IN_PODMAN="${IN_PODMAN:-false}"
|
||||
|
||||
# Working with apt under Debian/Ubuntu automation is a PITA, make it easy
|
||||
# Avoid some ways of getting stuck waiting for user input
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
# Short-cut for frequently used base command
|
||||
export APTGET='apt-get -qq --yes'
|
||||
# Short list of packages or quick-running command
|
||||
# Short timeout for quick-running packaging command
|
||||
SHORT_APTGET="timeout_attempt_delay_command 24s 5 30s $APTGET"
|
||||
# Long list / long-running command
|
||||
SHORT_DNFY="timeout_attempt_delay_command 60s 2 5s dnf -y"
|
||||
# Short timeout for quick-running packaging command
|
||||
LONG_APTGET="timeout_attempt_delay_command 300s 5 30s $APTGET"
|
||||
LONG_DNFY="timeout_attempt_delay_command 300s 3 60s dnf -y"
|
||||
|
||||
# Allow easy substitution for debugging if needed
|
||||
CONTAINER_RUNTIME="showrun ${CONTAINER_RUNTIME:-podman}"
|
||||
|
||||
# Pass in a list of one or more envariable names; exit non-zero with
|
||||
# helpful error message if any value is empty
|
||||
|
@ -152,16 +164,118 @@ install_ooe() {
|
|||
}
|
||||
|
||||
showrun() {
|
||||
if [[ "$1" == "--background" ]]
|
||||
then
|
||||
shift
|
||||
# Properly escape any nested spaces, so command can be copy-pasted
|
||||
echo '+ '$(printf " %q" "$@")' &' > /dev/stderr
|
||||
"$@" &
|
||||
echo -e "${RED}<backgrounded>${NOR}"
|
||||
else
|
||||
echo '--------------------------------------------------'
|
||||
echo '+ '$(printf " %q" "$@") > /dev/stderr
|
||||
"$@"
|
||||
fi
|
||||
local context
|
||||
context=($(caller 0))
|
||||
echo '+ '$(printf " %q" "$@")" # ${context[2]}:${context[0]} in ${context[1]}()" > /dev/stderr
|
||||
"$@"
|
||||
}
|
||||
|
||||
comment_out_storage_mountopt() {
|
||||
local FILEPATH=/etc/containers/storage.conf
|
||||
echo ">>>>>"
|
||||
echo ">>>>> Warning: comment_out_storage_mountopt() is modifying $FILEPATH"
|
||||
echo ">>>>>"
|
||||
sed -i -r -e 's/^(mountopt = .+)/#\1/' $FILEPATH
|
||||
}
|
||||
|
||||
in_podman() {
|
||||
req_env_var IN_PODMAN_NAME GOSRC HOME OS_RELEASE_ID
|
||||
[[ -n "$@" ]] || \
|
||||
die 7 "Must specify FQIN and command with arguments to execute"
|
||||
local envargs
|
||||
local envname
|
||||
local envvalue
|
||||
local envrx='(^CIRRUS_.+)|(^BUILDAH_+)|(^STOTAGE_)|(^CI$)|(^CROSS_TARGET$)|(^IN_PODMAN_.+)'
|
||||
for envname in $(awk 'BEGIN{for(v in ENVIRON) print v}' | \
|
||||
egrep "$envrx" | \
|
||||
egrep -v "CIRRUS_.+_MESSAGE" | \
|
||||
egrep -v "$SECRET_ENV_RE")
|
||||
do
|
||||
envvalue="${!envname}"
|
||||
[[ -z "$envname" ]] || [[ -z "$envvalue" ]] || \
|
||||
envargs="${envargs:+$envargs }-e $envname=$envvalue"
|
||||
done
|
||||
# Back in the days of testing under PAPR, containers were run with super-privledges.
|
||||
# That behavior is preserved here with a few updates for modern podman behaviors.
|
||||
# The only other additions/changes are passthrough of CI-related env. vars ($envargs),
|
||||
# some path related updates, and mounting cgroups RW instead of the RO default.
|
||||
showrun podman run -i --name $IN_PODMAN_NAME \
|
||||
$envargs \
|
||||
--net=host \
|
||||
--net="container:registry" \
|
||||
--security-opt label=disable \
|
||||
--security-opt seccomp=unconfined \
|
||||
--cap-add=all \
|
||||
-e "GOPATH=$GOPATH" \
|
||||
-e "IN_PODMAN=false" \
|
||||
-e "DIST=$OS_RELEASE_ID" \
|
||||
-e "CGROUP_MANAGER=cgroupfs" \
|
||||
-v "$GOSRC:$GOSRC:z" \
|
||||
--workdir "$GOSRC" \
|
||||
-v "$HOME/auth:$HOME/auth:ro" \
|
||||
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
|
||||
-v /dev/fuse:/dev/fuse:rw \
|
||||
$@
|
||||
}
|
||||
|
||||
execute_local_registry() {
|
||||
if nc -4 -z 127.0.0.1 5000
|
||||
then
|
||||
echo "Warning: Found listener on localhost:5000, NOT starting up local registry server."
|
||||
return 0
|
||||
fi
|
||||
req_env_var CONTAINER_RUNTIME GOSRC
|
||||
local authdirpath=$HOME/auth
|
||||
local certdirpath=/etc/docker/certs.d
|
||||
cd $GOSRC
|
||||
|
||||
echo "Creating a self signed certificate and get it in the right places"
|
||||
mkdir -p $authdirpath
|
||||
openssl req \
|
||||
-newkey rsa:4096 -nodes -sha256 -x509 -days 2 \
|
||||
-subj "/C=US/ST=Foo/L=Bar/O=Red Hat, Inc./CN=localhost" \
|
||||
-keyout $authdirpath/domain.key \
|
||||
-out $authdirpath/domain.crt
|
||||
|
||||
cp $authdirpath/domain.crt $authdirpath/domain.cert
|
||||
mkdir -p $certdirpath/docker.io/
|
||||
cp $authdirpath/domain.crt $certdirpath/docker.io/ca.crt
|
||||
mkdir -p $certdirpath/localhost:5000/
|
||||
cp $authdirpath/domain.crt $certdirpath/localhost:5000/ca.crt
|
||||
cp $authdirpath/domain.crt $certdirpath/localhost:5000/domain.crt
|
||||
|
||||
echo "Creating http credentials file"
|
||||
podman run --entrypoint htpasswd registry:2 \
|
||||
-Bbn testuser testpassword \
|
||||
> $authdirpath/htpasswd
|
||||
|
||||
echo "Starting up the local 'registry' container"
|
||||
podman run -d -p 5000:5000 --name registry \
|
||||
-v $authdirpath:$authdirpath:Z \
|
||||
-e "REGISTRY_AUTH=htpasswd" \
|
||||
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
|
||||
-e REGISTRY_AUTH_HTPASSWD_PATH=$authdirpath/htpasswd \
|
||||
-e REGISTRY_HTTP_TLS_CERTIFICATE=$authdirpath/domain.crt \
|
||||
-e REGISTRY_HTTP_TLS_KEY=$authdirpath/domain.key \
|
||||
registry:2
|
||||
|
||||
echo "Verifying local 'registry' container is operational"
|
||||
showrun podman version
|
||||
showrun podman info
|
||||
showrun podman ps --all
|
||||
showrun podman images
|
||||
showrun ls -alF $HOME/auth
|
||||
showrun podman pull alpine
|
||||
showrun podman login localhost:5000 --username testuser --password testpassword
|
||||
showrun podman tag alpine localhost:5000/my-alpine
|
||||
showrun podman push --creds=testuser:testpassword localhost:5000/my-alpine
|
||||
showrun podman ps --all
|
||||
showrun podman images
|
||||
showrun podman rmi docker.io/alpine
|
||||
showrun podman rmi localhost:5000/my-alpine
|
||||
showrun podman pull --creds=testuser:testpassword localhost:5000/my-alpine
|
||||
showrun podman ps --all
|
||||
showrun podman images
|
||||
echo "Success, cleaning up."
|
||||
showrun podman rmi localhost:5000/my-alpine
|
||||
}
|
||||
|
|
|
@ -68,24 +68,30 @@ echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER" # STUB: Add VM setup instructi
|
|||
cd $GOSRC
|
||||
case "$OS_REL_VER" in
|
||||
fedora-*)
|
||||
# When the fedora repos go down, it tends to last quite a while :(
|
||||
timeout_attempt_delay_command 120s 3 120s dnf install -y \
|
||||
# Filling up cache is very slow and failures can last quite a while :(
|
||||
$LONG_DNFY install \
|
||||
'@C Development Tools and Libraries' '@Development Tools' \
|
||||
$FEDORA_PACKAGES
|
||||
# Executing tests in a container requires SELinux boolean set on the host
|
||||
if [[ "$IN_PODMAN" == "true" ]]
|
||||
then
|
||||
setsebool -P container_manage_cgroup true
|
||||
fi
|
||||
;;
|
||||
ubuntu-*)
|
||||
$SHORT_APTGET update
|
||||
$LONG_APTGET upgrade
|
||||
$SHORT_APTGET install software-properties-common
|
||||
ppas=(ppa:projectatomic/ppa)
|
||||
if [[ "$OS_RELEASE_VER" == "18" ]]
|
||||
then
|
||||
echo "(Enabling newer golang on Ubuntu LTS version)"
|
||||
$SHORT_APTGET install software-properties-common
|
||||
$SHORT_APTGET update
|
||||
for ppa in ppa:longsleep/golang-backports ppa:projectatomic/ppa; do
|
||||
timeout_attempt_delay_command 30 2 30 \
|
||||
add-apt-repository --yes $ppa
|
||||
done
|
||||
ppas+=(ppa:longsleep/golang-backports) # newer golang
|
||||
fi
|
||||
for ppa in ${ppas[@]}; do
|
||||
timeout_attempt_delay_command 30 2 30 \
|
||||
add-apt-repository --yes $ppa
|
||||
done
|
||||
$SHORT_APTGET update
|
||||
$LONG_APTGET install \
|
||||
build-essential \
|
||||
$UBUNTU_PACKAGES
|
||||
|
@ -98,5 +104,21 @@ esac
|
|||
# Previously, golang was not installed
|
||||
source $(dirname $0)/lib.sh
|
||||
|
||||
echo "Installing buildah tooling"
|
||||
showrun make install.tools
|
||||
show_env_vars
|
||||
|
||||
if [[ -z "$CROSS_TARGET" ]]
|
||||
then
|
||||
comment_out_storage_mountopt # workaround issue 1945 (remove when resolved)
|
||||
|
||||
execute_local_registry # checks for existing port 5000 listener
|
||||
|
||||
if [[ "$IN_PODMAN" == "true" ]]
|
||||
then
|
||||
req_env_var IN_PODMAN_IMAGE IN_PODMAN_NAME
|
||||
echo "Setting up image to use for \$IN_PODMAN=true testing"
|
||||
cd $GOSRC
|
||||
in_podman $IN_PODMAN_IMAGE $0
|
||||
showrun podman commit $IN_PODMAN_NAME $IN_PODMAN_NAME
|
||||
showrun podman rm -f $IN_PODMAN_NAME
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
source $(dirname $0)/lib.sh
|
||||
|
||||
req_env_var IN_PODMAN IN_PODMAN_NAME GOSRC 1
|
||||
|
||||
if [[ "$IN_PODMAN" == "true" ]]
|
||||
then
|
||||
cd $GOSRC
|
||||
# Host build environment != container environment
|
||||
make clean
|
||||
in_podman --rm $IN_PODMAN_NAME:latest $0 $1
|
||||
elif [[ -z "$CROSS_TARGET" ]]
|
||||
then
|
||||
cd $GOSRC
|
||||
|
||||
showrun make
|
||||
showrun make install.tools
|
||||
|
||||
case $1 in
|
||||
validate)
|
||||
# Required for specifying our own commit range to git-validate.sh
|
||||
export TRAVIS=true
|
||||
export GITVALIDATE_EPOCH="$CIRRUS_BASE_SHA"
|
||||
export GITVALIDATE_TIP="$CIRRUS_CHANGE_IN_REPO"
|
||||
# The big 'Golint: can't lint 3 files...' warning puke, harmless and fixed in v1.20.0
|
||||
showrun make lint
|
||||
# TODO: This will fail if PR HEAD != upstream branch head
|
||||
showrun make validate
|
||||
;;
|
||||
unit)
|
||||
showrun make test-unit
|
||||
;;
|
||||
integration)
|
||||
showrun make test-integration
|
||||
;;
|
||||
*)
|
||||
die 1 "First parameter to $(basename $0) not supported: '$1'"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "Testing a cross-compiled $CROSS_TARGET target not possible on this platform"
|
||||
fi
|
|
@ -95,7 +95,7 @@ parse_args(){
|
|||
show_usage "This script must be run as a regular user."
|
||||
fi
|
||||
|
||||
ENVS='GOPATH="/var/tmp/go"
|
||||
ENVS='GOPATH="/var/tmp/go" IN_PODMAN="false" CROSS_TARGET=""'
|
||||
IMAGE_NAME="$1"
|
||||
if [[ -z "$IMAGE_NAME" ]]
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue