Message ID | 20200611173039.21742-1-william.c.roberts@intel.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v2] ci: dont use hardcoded project name | expand |
On Thu, Jun 11, 2020 at 12:30:39PM -0500, bill.c.roberts@gmail.com wrote: > From: William Roberts <william.c.roberts@intel.com> > > Not everyone's github project is "selinux" so use the projects > name, as derived from TRAVIS_BUILD_DIR. TRAVIS_BUILD_DIR is > the absolute path to the project checkout on disk, so the > basename should be sufficient. The script that runs in the KVM > environment also needs to be updated where it can find the > selinux project code, so we pass it in through an env variable > in the ssh command. > > Tested on Travis CI here: > - https://travis-ci.org/github/williamcroberts/selinux/jobs/697307824 > > Signed-off-by: William Roberts <william.c.roberts@intel.com> Acked-by: Petr Lautrbach <plautrba@redhat.com> Thanks! > --- > v2: > - Fix the KVM script project location when it's not /root/selinux. > > scripts/ci/fedora-test-runner.sh | 10 ++++++++-- > scripts/ci/travis-kvm-setup.sh | 6 ++++-- > 2 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/scripts/ci/fedora-test-runner.sh b/scripts/ci/fedora-test-runner.sh > index 0927ed5dad8f..569723387f6b 100755 > --- a/scripts/ci/fedora-test-runner.sh > +++ b/scripts/ci/fedora-test-runner.sh > @@ -2,6 +2,12 @@ > > set -ev > > +# > +# We expect this to be set in the environment, but if it's not, most selinux projects > +# just have the same name as upstream, so choose that. > +# > +export SELINUX_DIR="${SELINUX_DIR:-/root/selinux}" > + > # CI Debug output if things go squirrely. > getenforce > id -Z > @@ -58,7 +64,7 @@ dnf install -y \ > # > # Move to selinux code and build > # > -cd "$HOME/selinux" > +cd "$SELINUX_DIR" > > # Show HEAD commit for sanity checking > git log -1 > @@ -71,7 +77,7 @@ make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install-pywrap > make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 relabel > > # > -# Get the selinux testsuite, but don't clone it in $HOME/selinux, move to $HOME > +# Get the selinux testsuite, but don't clone it in selinux git directory, move to $HOME > # first. > # > cd "$HOME" > diff --git a/scripts/ci/travis-kvm-setup.sh b/scripts/ci/travis-kvm-setup.sh > index 864dbac96a46..8d4cfb79f7d7 100755 > --- a/scripts/ci/travis-kvm-setup.sh > +++ b/scripts/ci/travis-kvm-setup.sh > @@ -118,8 +118,10 @@ fi > # > # Great we have a host running, ssh into it. We specify -o so > # we don't get blocked on asking to add the servers key to > -# our known_hosts. > +# our known_hosts. Also, we need to forward the project directory > +# so forks know where to go. > # > -ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" "/root/selinux/$TEST_RUNNER" > +project_dir="$(basename "$TRAVIS_BUILD_DIR")" > +ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" "SELINUX_DIR=/root/$project_dir /root/$project_dir/$TEST_RUNNER" > > exit 0 > -- > 2.17.1 >
On Fri, Jun 12, 2020 at 1:39 AM Petr Lautrbach <plautrba@redhat.com> wrote: > > On Thu, Jun 11, 2020 at 12:30:39PM -0500, bill.c.roberts@gmail.com wrote: > > From: William Roberts <william.c.roberts@intel.com> > > > > Not everyone's github project is "selinux" so use the projects > > name, as derived from TRAVIS_BUILD_DIR. TRAVIS_BUILD_DIR is > > the absolute path to the project checkout on disk, so the > > basename should be sufficient. The script that runs in the KVM > > environment also needs to be updated where it can find the > > selinux project code, so we pass it in through an env variable > > in the ssh command. > > > > Tested on Travis CI here: > > - https://travis-ci.org/github/williamcroberts/selinux/jobs/697307824 > > > > Signed-off-by: William Roberts <william.c.roberts@intel.com> > > Acked-by: Petr Lautrbach <plautrba@redhat.com> Since I saw that you have been creating and testing a 3.1-rc2 branch I have held off on merging any further patches even ones that have been acked; I'll wait until you finalize that with whatever set of patches you have picked up.
On Wed, Jun 17, 2020 at 01:07:35PM -0400, Stephen Smalley wrote: > On Fri, Jun 12, 2020 at 1:39 AM Petr Lautrbach <plautrba@redhat.com> wrote: > > > > On Thu, Jun 11, 2020 at 12:30:39PM -0500, bill.c.roberts@gmail.com wrote: > > > From: William Roberts <william.c.roberts@intel.com> > > > > > > Not everyone's github project is "selinux" so use the projects > > > name, as derived from TRAVIS_BUILD_DIR. TRAVIS_BUILD_DIR is > > > the absolute path to the project checkout on disk, so the > > > basename should be sufficient. The script that runs in the KVM > > > environment also needs to be updated where it can find the > > > selinux project code, so we pass it in through an env variable > > > in the ssh command. > > > > > > Tested on Travis CI here: > > > - https://travis-ci.org/github/williamcroberts/selinux/jobs/697307824 > > > > > > Signed-off-by: William Roberts <william.c.roberts@intel.com> > > > > Acked-by: Petr Lautrbach <plautrba@redhat.com> > > Since I saw that you have been creating and testing a 3.1-rc2 branch I > have held off on merging any further patches even ones that have been > acked; I'll wait until you finalize that with whatever set of patches > you have picked up. > Thanks, I'll merge everything acked later today and create 3.1-rc2 tomorrow morning. And I'm sorry for big delays on my side.
diff --git a/scripts/ci/fedora-test-runner.sh b/scripts/ci/fedora-test-runner.sh index 0927ed5dad8f..569723387f6b 100755 --- a/scripts/ci/fedora-test-runner.sh +++ b/scripts/ci/fedora-test-runner.sh @@ -2,6 +2,12 @@ set -ev +# +# We expect this to be set in the environment, but if it's not, most selinux projects +# just have the same name as upstream, so choose that. +# +export SELINUX_DIR="${SELINUX_DIR:-/root/selinux}" + # CI Debug output if things go squirrely. getenforce id -Z @@ -58,7 +64,7 @@ dnf install -y \ # # Move to selinux code and build # -cd "$HOME/selinux" +cd "$SELINUX_DIR" # Show HEAD commit for sanity checking git log -1 @@ -71,7 +77,7 @@ make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install-pywrap make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 relabel # -# Get the selinux testsuite, but don't clone it in $HOME/selinux, move to $HOME +# Get the selinux testsuite, but don't clone it in selinux git directory, move to $HOME # first. # cd "$HOME" diff --git a/scripts/ci/travis-kvm-setup.sh b/scripts/ci/travis-kvm-setup.sh index 864dbac96a46..8d4cfb79f7d7 100755 --- a/scripts/ci/travis-kvm-setup.sh +++ b/scripts/ci/travis-kvm-setup.sh @@ -118,8 +118,10 @@ fi # # Great we have a host running, ssh into it. We specify -o so # we don't get blocked on asking to add the servers key to -# our known_hosts. +# our known_hosts. Also, we need to forward the project directory +# so forks know where to go. # -ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" "/root/selinux/$TEST_RUNNER" +project_dir="$(basename "$TRAVIS_BUILD_DIR")" +ssh -tt -o StrictHostKeyChecking=no -o LogLevel=QUIET "root@$ipaddy" "SELINUX_DIR=/root/$project_dir /root/$project_dir/$TEST_RUNNER" exit 0