From 9df4c043599362d4c5c77f785c7cfa9437d3136b Mon Sep 17 00:00:00 2001 From: Aleksei Burlakov Date: Thu, 26 Feb 2026 13:25:28 +0100 Subject: [PATCH] Test: add leap16.0 hawk-node --- .../Dockerfile} | 0 .github/docker/hawk-node.leap160/Dockerfile | 36 +++++ .../make-sle16-compatible.patch | 39 ++++++ .../update-hawk-backend-service.patch | 21 +++ .github/workflows/test-hawk.yaml | 124 ++++++++++++++++-- 5 files changed, 210 insertions(+), 10 deletions(-) rename .github/docker/{hawk-node.Dockerfile => hawk-node.leap156/Dockerfile} (100%) create mode 100644 .github/docker/hawk-node.leap160/Dockerfile create mode 100644 .github/docker/hawk-node.leap160/make-sle16-compatible.patch create mode 100644 .github/docker/hawk-node.leap160/update-hawk-backend-service.patch diff --git a/.github/docker/hawk-node.Dockerfile b/.github/docker/hawk-node.leap156/Dockerfile similarity index 100% rename from .github/docker/hawk-node.Dockerfile rename to .github/docker/hawk-node.leap156/Dockerfile diff --git a/.github/docker/hawk-node.leap160/Dockerfile b/.github/docker/hawk-node.leap160/Dockerfile new file mode 100644 index 000000000..cff7b4294 --- /dev/null +++ b/.github/docker/hawk-node.leap160/Dockerfile @@ -0,0 +1,36 @@ +FROM docker.io/opensuse/leap:16.0 + +# install deps (hawk2 will pull all the gems, but uglifier) +# libglue-devel is for stonith:external/ssh params hostlist +RUN zypper -n refresh \ + && zypper -n install --no-recommends \ + systemd openssh-server \ + make gcc pam-devel hawk2 nodejs git \ + && zypper -n clean -a + +# allow root password login (specifically for the tests) +RUN sed -i \ + -e 's/^#\?PermitRootLogin .*/PermitRootLogin yes/' \ + -e 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' \ + /usr/etc/ssh/sshd_config + +RUN ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa \ + && cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys + +# unlock root and set password to "linux" +RUN passwd -u root || true && echo -e "linux\nlinux" | passwd root + +# start sshd under systemd (`crm cluster init` will start it later anyway) +RUN systemctl enable sshd + +# backup the Gemfiles +RUN cp /usr/share/hawk/Gemfile* / + +# no need for the hawk itself, it should be copied in the git workflow +RUN rm -rf /usr/share/hawk /etc/sysconfig/hawk + +COPY *.patch / + +ENV GEM_HOME=/usr/libexec/hawk/vendor/ + +CMD ["/usr/lib/systemd/systemd", "--system"] diff --git a/.github/docker/hawk-node.leap160/make-sle16-compatible.patch b/.github/docker/hawk-node.leap160/make-sle16-compatible.patch new file mode 100644 index 000000000..20e0d6419 --- /dev/null +++ b/.github/docker/hawk-node.leap160/make-sle16-compatible.patch @@ -0,0 +1,39 @@ +diff --git a/hawk/config/application.rb b/hawk/config/application.rb +--- a/hawk/config/application.rb ++++ b/hawk/config/application.rb +@@ -44,6 +44,11 @@ module Hawk + config.middleware.use Rack::Deflater + end + ++ JsRoutes.setup do |config| ++ config.module_type = nil ++ config.namespace = "Routes" ++ end ++ + config.x.hawk_is_sles = system("cat /etc/os-release | grep 'ID=.*sles' >/dev/null 2>&1") + + def lookup_daemon_dir +diff --git a/hawk/config/boot.rb b/hawk/config/boot.rb +--- a/hawk/config/boot.rb ++++ b/hawk/config/boot.rb +@@ -38,7 +38,7 @@ else + gem "virtus", version: "~> 1.0" + require "virtus" + +- gem "js-routes", version: ">= 1.3.3" ++ gem "js-routes", version: ">= 2.0.0" + require "js-routes" + + gem "fast_gettext", version: "~> 1.4" +diff --git a/hawk/config/environments/development.rb b/hawk/config/environments/development.rb +--- a/hawk/config/environments/development.rb ++++ b/hawk/config/environments/development.rb +@@ -27,7 +27,7 @@ Rails.application.configure do + + config.cache_store = :memory_store + +- config.assets.debug = true ++ config.assets.debug = false + config.assets.raise_runtime_errors = true + config.assets.js_compressor = nil + config.assets.css_compressor = nil diff --git a/.github/docker/hawk-node.leap160/update-hawk-backend-service.patch b/.github/docker/hawk-node.leap160/update-hawk-backend-service.patch new file mode 100644 index 000000000..e15cff633 --- /dev/null +++ b/.github/docker/hawk-node.leap160/update-hawk-backend-service.patch @@ -0,0 +1,21 @@ +diff --git a/scripts/hawk-backend.service.in b/scripts/hawk-backend.service.in +index aafcadb7..143d6f66 100644 +--- a/scripts/hawk-backend.service.in ++++ b/scripts/hawk-backend.service.in +@@ -8,12 +8,11 @@ Type=simple + KillMode=control-group + TimeoutSec=300 + TimeoutStopSec=10 +-User=hacluster +-Group=haclient + WorkingDirectory=@WWW_BASE@/hawk + Environment="HAWK_ENV=production" ++Environment="GEM_HOME=/usr/libexec/hawk/vendor/" + Environment="HAWK_BIND=unix://@WWW_BASE@/hawk/tmp/hawk.sock" + EnvironmentFile=-/etc/sysconfig/hawk +-ExecStart=/usr/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb +-ExecStop=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop +-ExecReload=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart ++ExecStart=/usr/libexec/hawk/vendor/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb ++ExecStop=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop ++ExecReload=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart diff --git a/.github/workflows/test-hawk.yaml b/.github/workflows/test-hawk.yaml index c248c785a..a609296eb 100644 --- a/.github/workflows/test-hawk.yaml +++ b/.github/workflows/test-hawk.yaml @@ -1,4 +1,4 @@ -name: e2e_test for hawk +name: e2e_test for hawk on leap15.6 and leap16.0 on: push: branches: @@ -12,47 +12,151 @@ env: IP_NODE2: 172.17.0.3 jobs: - functional_test_hawk: + build_examiner: runs-on: ubuntu-latest steps: - - name: Check out repository code - uses: actions/checkout@v2 - - name: Build hawk-node image - run: | - docker build -t hawk-node -f .github/docker/hawk-node.Dockerfile . + - uses: actions/checkout@v4 - name: Build hawk-examiner image run: | docker build -t hawk-examiner -f e2e_test/Dockerfile e2e_test + + - name: Export hawk-examiner image + run: | + docker save hawk-examiner:latest -o hawk-examiner.tar + + - name: Upload hawk-examiner image artifact + uses: actions/upload-artifact@v4 + with: + name: hawk-examiner-image + path: hawk-examiner.tar + + test_leap156: + runs-on: ubuntu-latest + needs: build_examiner + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Download hawk-examiner image artifact + uses: actions/download-artifact@v4 + with: + name: hawk-examiner-image + + - name: Load hawk-examiner image + run: | + docker load -i hawk-examiner.tar + + - name: Build hawk-node leap-15.6 image + run: | + docker build -t hawk-node -f .github/docker/hawk-node.leap156/Dockerfile .github/docker/hawk-node.leap156/ + - name: Start cluster nodes in containers run: | docker run -d --privileged -h node1 --name node1 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node docker run -d --privileged -h node2 --name node2 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node + - name: Copy hawk to the nodes run: | docker cp "$GITHUB_WORKSPACE" node1:/ docker cp "$GITHUB_WORKSPACE" node2:/ + - name: Compile hawk in the nodes run: | docker exec -i node1 bash -c "cd hawk && make" docker exec -i node2 bash -c "cd hawk && make" + - name: Install hawk in the nodes run: | docker exec -i node1 bash -c "cd hawk && make install && cp scripts/sysconfig.hawk /etc/sysconfig/hawk" docker exec -i node2 bash -c "cd hawk && make install && cp scripts/sysconfig.hawk /etc/sysconfig/hawk" + - name: Workaround to run hawk as root (ok for tests) run: | docker exec node1 sed -i '/^User=/d' /usr/lib/systemd/system/hawk-backend.service docker exec node1 sed -i '/^Group=/d' /usr/lib/systemd/system/hawk-backend.service docker exec node2 sed -i '/^User=/d' /usr/lib/systemd/system/hawk-backend.service docker exec node2 sed -i '/^Group=/d' /usr/lib/systemd/system/hawk-backend.service + - name: Initialize container on the node1 - run: docker exec node1 crm cluster init -u -n cluster1 -y + run: | + docker exec node1 crm cluster init -u -n cluster1 -y + - name: Join node2 to the cluster - run: docker exec node2 crm cluster join -c node1 -y + run: | + docker exec node2 crm cluster join -c node1 -y + - name: Create a stonith-sbd device run: | docker exec node1 crm configure primitive stonith-sbd stonith:external/ssh params hostlist="node1 node2" docker exec node1 crm conf property stonith-enabled=true docker exec node1 crm conf property have-watchdog=true + + - name: Run the functional test + run: | + docker run --rm hawk-examiner -H ${IP_NODE1} -S ${IP_NODE2} -s linux --xvfb + + - name: Cleanup + if: always() + run: | + docker rm -f node1 node2 || true + + test_leap160: + runs-on: ubuntu-latest + needs: build_examiner + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Download hawk-examiner image artifact + uses: actions/download-artifact@v4 + with: + name: hawk-examiner-image + + - name: Load hawk-examiner image + run: | + docker load -i hawk-examiner.tar + + - name: Build hawk-node leap-16.0 image + run: | + docker build -t hawk-node -f .github/docker/hawk-node.leap160/Dockerfile .github/docker/hawk-node.leap160/ + + - name: Start cluster nodes in containers + run: | + docker run -d --privileged -h node1 --name node1 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node + + - name: Copy hawk to the nodes + run: | + docker cp "$GITHUB_WORKSPACE" node1:/ + + - name: Apply patches and replace Gemfiles + run: | + docker exec -i node1 bash -c "cd hawk && git apply ../*.patch && cp /Gemfile* hawk" + + - name: Compile hawk in the nodes + run: | + docker exec -i node1 bash -c "cd hawk && make" + + - name: Install hawk in the nodes + run: | + docker exec -i node1 bash -c "cd hawk && make install && cp scripts/sysconfig.hawk /etc/sysconfig/hawk" + + - name: Initialize container on the node1 + run: | + docker exec node1 crm cluster init -n cluster2 -y + + - name: Check status of hawk + run: | + docker exec node1 systemctl status hawk hawk-backend + + - name: Create a stonith-sbd device + run: | + docker exec node1 crm configure primitive stonith-sbd ocf:pacemaker:Dummy + - name: Run the functional test - run: docker run hawk-examiner -H ${IP_NODE1} -S ${IP_NODE2} -s linux --xvfb + run: | + docker run --rm hawk-examiner -H ${IP_NODE1} -s linux --xvfb + + - name: Cleanup + if: always() + run: | + docker rm -f node1 || true