From 7c2ec35a440f40687fd62ffc1771313c89d695c1 Mon Sep 17 00:00:00 2001 From: Felix Schizlein Date: Mon, 5 Feb 2024 19:24:54 +0100 Subject: [PATCH] Do not install ci scripts into bin/ --- .github/workflows/features.yml | 51 +++++++++++++++++++++++++++++----- Makefile | 2 +- ci/Dockerfile | 18 +----------- ci/rmt-build-rpm | 3 +- ci/rmt-configure | 9 ++++++ 5 files changed, 57 insertions(+), 26 deletions(-) diff --git a/.github/workflows/features.yml b/.github/workflows/features.yml index 066ae6eae..ce12d1ba3 100644 --- a/.github/workflows/features.yml +++ b/.github/workflows/features.yml @@ -1,16 +1,25 @@ --- +name: feature tests -name: RMT feature tests on: pull_request: branches: [master] +env: + SOURCE: /usr/src/rmt-server + SCC_USERNAME: ${{ secrets.SCC_USERNAME }} + SCC_PASSWORD: ${{ secrets.SCC_PASSWORD }} + SYSTEM_UUID: ${{ secrets.SYSTEM_UUID }} + + # Within containters Github Actions does create a bridged network exposing + # the service named after its label + MYSQL_HOST: mysql + jobs: feature-tests: runs-on: ubuntu-latest defaults: run: - shell: bash working-directory: /usr/src/rmt-server container: image: registry.opensuse.org/systemsmanagement/scc/containers/15.5/rmt-ci-container:latest @@ -35,14 +44,42 @@ jobs: with: fetch-depth: 0 - - name: build rpm + - name: move source to /usr/src/rmt-server run: | - rmt-build-rpm + [ -d $SOURCE ] && rm -r $SOURCE + cp -r $GITHUB_WORKSPACE $SOURCE + + # - name: cache vendor directory + # id: vendor-cache + # uses: actions/cache@v4 + # with: + # path: ${{ env.SOURCE }}/vendor/ + # key: vendor-cache + + # - name: update vendor cache + # if: steps.vendor-cache.outputs.cache-hit != 'true' + # run: | + # bundle install + # bundle package --all + + # - name: update gem depdendencies + # run: | + # bundle install + + - name: build RPM package + run: | + bash ci/rmt-build-rpm + + - name: gather RPM build artifacts + uses: actions/upload-artifact@v4 + with: + name: rmt-server-rpms + path: ${{ env.SOURCE }}/tmp/artifacts/*.rpm - - name: configure rmt + - name: configure RMT to run feature tests run: | - rmt-configure + bash ci/rmt-configure - name: run feature tests run: | - rmt-run-feature-tests + bash ci/rmt-run-feature-tests diff --git a/Makefile b/Makefile index 2e46640c1..e53563184 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ clean: rm -rf $(NAME)-$(VERSION)/ man: - bundle exec ronn --roff --pipe --manual RMT MANUAL.md > rmt-cli.8 && gzip -f rmt-cli.8 + ronn --roff --pipe --manual RMT MANUAL.md > rmt-cli.8 && gzip -f rmt-cli.8 mv rmt-cli.8.gz package/obs dist: clean man diff --git a/ci/Dockerfile b/ci/Dockerfile index e8e5b9fc3..14e3319ef 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -11,21 +11,5 @@ RUN zypper --non-interactive in make chrpath fdupes gcc libcurl-devel libffi-dev RUN update-alternatives --install /usr/bin/bundle bundle /usr/bin/bundle.ruby2.5 5 && \ update-alternatives --install /usr/bin/bundler bundler /usr/bin/bundler.ruby2.5 5 -VOLUME /usr/src/rmt-server -VOLUME /usr/ - -ARG SCC_USERNAME -ARG SCC_PASSWORD - -# Prepare ruby environment -ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1 - -# Add rmt ci/development scripts -RUN mkdir -p /usr/src/rmt-server /usr/local/bin - -COPY rmt-build-rpm /usr/local/bin/ -COPY rmt-configure /usr/local/bin/ -COPY rmt-console /usr/local/bin/ -COPY rmt-run-feature-tests /usr/local/bin/ - +RUN mkdir /usr/src/rmt-server WORKDIR /usr/src/rmt-server diff --git a/ci/rmt-build-rpm b/ci/rmt-build-rpm index d00b750a4..b73aad466 100755 --- a/ci/rmt-build-rpm +++ b/ci/rmt-build-rpm @@ -25,7 +25,7 @@ pushd $SOURCE make dist cp $SOURCE/package/obs/rmt-server-$VERSION.tar.bz2 $ARTIFACT_DIR popd -group +groupend group "prepare build environment (in $BUILD_DIR)" pushd $BUILD_DIR @@ -38,5 +38,6 @@ group "build rmt-server-$VERSION.x86_64.rpm" pushd $BUILD_DIR rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --undefine _enable_debug_packages SOURCES/rmt-server.spec cp -r RPMS/x86_64/rmt-server-$VERSION*.rpm $ARTIFACT_DIR/ + cp -r RPMS/x86_64/rmt-server-config-$VERSION*.rpm $ARTIFACT_DIR/ popd groupend diff --git a/ci/rmt-configure b/ci/rmt-configure index 6140ccea4..91b1a6195 100755 --- a/ci/rmt-configure +++ b/ci/rmt-configure @@ -26,6 +26,10 @@ MYSQL_PASSWORD=${MYSQL_PASSWORD:-rmt} MYSQL_DATABASE=${MYSQL_DATABASE:-rmt_features} MYSQL_PORT=${MYSQL_PORT:-3306} +# The systems uuid to use to identify this proxy (namely to not +# create a new proxy each time this is running!) +SYSTEM_UUID=${SYSTEM_UUID:-$(uuidgen)} + group() { echo "::group::$@"; } groupend() { echo "::groupend::"; } fail() { echo "::error::$@"; exit 1; } @@ -34,6 +38,11 @@ if [ "x$SCC_PASSWORD" = "x" ] || [ "x$SCC_USERNAME" = "x" ]; then fail "To correctly configure RMT environment variables \$SCC_USERNAME and \$SCC_PASSWORD are required. Check your environment!" fi +group "setup system uuid" + mkdir -p /var/lib/rmt/ + echo "$SYSTEM_UUID" > /var/lib/rmt/system_uuid +groupend + group "install rmt-server rpms" pushd $BUILD_DIR/RPMS/x86_64 zypper --non-interactive --no-refresh install --allow-unsigned-rpm $RPMS