Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:feature/run-container into cloud-init:master
Review: Approve continuous-integration PASSED: Continuous integration, rev:0f39683b69929dff3edf6ee078af31b6424e0dff https://jenkins.ubuntu.com/server/job/cloud-init-ci/1139/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration SUCCESS: MAAS Compatability Testing IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1139/rebuild -- https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/345627 Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:feature/run-container into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:feature/run-container into cloud-init:master
Review: Needs Fixing continuous-integration FAILED: Continuous integration, rev:e8df99682baa220cdba19e3b46fc06badcbe9c19 https://jenkins.ubuntu.com/server/job/cloud-init-ci/1133/ Executed test runs: SUCCESS: Checkout FAILED: Unit & Style Tests Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1133/rebuild -- https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/345627 Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:feature/run-container into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:feature/run-container into cloud-init:master
Review: Approve continuous-integration PASSED: Continuous integration, rev: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1131/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration SUCCESS: MAAS Compatability Testing IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1131/rebuild -- https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/345627 Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:feature/run-container into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:feature/run-container into cloud-init:master
i fixed the issue with the test. it was just a bug in tools/run-container. -- https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/345627 Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:feature/run-container into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:feature/run-container into cloud-init:master
I ran through a few runs with Debian and Fedora, looked good comments below. Thanks for making the deprecation message and existing script. Not sure why CI failed, but I'll look once it is up and running again. Diff comments: > diff --git a/tools/run-container b/tools/run-container > new file mode 100755 > index 000..ba4b18e > --- /dev/null > +++ b/tools/run-container > @@ -0,0 +1,562 @@ > +#!/bin/bash > +# This file is part of cloud-init. See LICENSE file for license information. > + > +set -u > + > +VERBOSITY=0 > +KEEP=false > +CONTAINER="" > +DEFAULT_WAIT_MAX=30 > + > +error() { echo "$@" 1>&2; } > +fail() { [ $# -eq 0 ] || error "$@"; exit 1; } > +errorrc() { local r=$?; error "$@" "ret=$r"; return $r; } > + > +Usage() { > +cat < +Usage: ${0##*/} [ options ] [images:]image-ref > + > +This utility can makes it easier to run tests, build rpm and source rpm > +generation inside a LXC of the specified version of CentOS. > + > +To see images available, run 'lxc image list images:' > +Example input: > + centos/7 > + opensuse/42.3 > + debian/10 > + > +options: > + -a | --artifact keep build artifacts > + --dirtyapply local changes before running tests. > + If not provided, a clean checkout of branch is tested. > + Inside container, changes are in local-changes.diff. > + -k | --keep keep container after tests > + --pyexe V python version to use. Default=auto. > + Should be name of an executable. ('python2' or > 'python3') > + -p | --package build a binary package (.deb or .rpm) > + -s | --source-package build source package (debuild -S or srpm) > + -u | --unittest run unit tests > + > +Example: > + * ${0##*/} --package --source-package --unittest centos/6 > +EOF > +} > + > +bad_Usage() { Usage 1>&2; [ $# -eq 0 ] || error "$@"; return 1; } > +cleanup() { > +if [ -n "$CONTAINER" -a "$KEEP" = "false" ]; then > +delete_container "$CONTAINER" > +fi > +} > + > +debug() { > +local level=${1}; shift; > +[ "${level}" -gt "${VERBOSITY}" ] && return > +error "${@}" > +} > + > + > +inside_as() { > +# inside_as(container_name, user, cmd[, args]) > +# executes cmd with args inside container as user in users home dir. > +local name="$1" user="$2" > +shift 2 > +if [ "$user" = "root" ]; then > +inside "$name" "$@" > +return > +fi > +local stuffed="" b64="" > +stuffed=$(getopt --shell sh --options "" -- -- "$@") > +stuffed=${stuffed# -- } > +b64=$(printf "%s\n" "$stuffed" | base64 --wrap=0) > +inside "$name" su "$user" -c \ > +'cd; eval set -- "$(echo '$b64' | base64 --decode)" && exec "$@"' > +} > + > +inside_as_cd() { > +local name="$1" user="$2" dir="$3" > +shift 3 > +inside_as "$name" "$user" sh -c 'cd "$0" && exec "$@"' "$dir" "$@" > +} > + > +inside() { > +local name="$1" > +shift > +lxc exec "$name" -- "$@" > +} > + > +inject_cloud_init(){ > +# take current cloud-init git dir and put it inside $name at > +# ~$user/cloud-init. > +local name="$1" user="$2" dirty="$3" > +local changes="" top_d="" dname="cloud-init" pstat="" > +local gitdir="" commitish="" > +gitdir=$(git rev-parse --git-dir) || { > +errorrc "Failed to get git dir in $PWD"; > +return > +} > +local t=${gitdir%/*} > +case "$t" in > +*/worktrees) > +if [ -f "${t%worktrees}/config" ]; then > +gitdir="${t%worktrees}" > +fi > +esac > + > +# attempt to get branch name. > +commitish=$(git rev-parse --abbrev-ref HEAD) || { > +errorrc "Failed git rev-parse --abbrev-ref HEAD" > +return > +} > +if [ "$commitish" = "HEAD" ]; then > +# detached head > +commitish=$(git rev-parse HEAD) || { > +errorrc "failed git rev-parse HEAD" > +return > +} > +fi > + > +local local_changes=false > +if ! git diff --quiet "$commitish"; then > +# there are local changes not committed. > +local_changes=true > +if [ "$dirty" = "false" ]; then > +error "WARNING: You had uncommitted changes. Those changes will > " > +error "be put into 'local-changes.diff' inside the container. " > +error "To test these changes you must pass --dirty." > +fi > +fi > + > +debug 1 "collecting ${gitdir} ($dname) into user $user in $name." > +tar -C "${gitdir}" -cpf - . | > +inside_as "$name" "$user" sh -ec ' > +dname=$1 > +commitish=$2 > +rm -Rf "$dname" > +mkdir -p $dname/.git > +cd $dname/.git > +tar -xpf - > +cd .. > +git config core.bare false > +out=$(git checkout $commitish 2>&1) || > +{ echo "failed
Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:feature/run-container into cloud-init:master
Before looking at this, one thing to note is that CI will obviously need to be updated before this is landed and unless someone rebases re-runs will fail -- https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/345627 Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:feature/run-container into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:feature/run-container into cloud-init:master
Review: Needs Fixing continuous-integration FAILED: Continuous integration, rev:85ada88e35930d2ab2cbb9a7a436bcfd992f9a71 https://jenkins.ubuntu.com/server/job/cloud-init-ci/1128/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration FAILED: MAAS Compatability Testing Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1128/rebuild -- https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/345627 Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:feature/run-container into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp