Visitar URL original
Merge pull request #333 from aleksei-burlakov/test-cicd2 · ClusterLabs/hawk@563236e · GitHub
Skip to content

Commit 563236e

Browse files
Merge pull request #333 from aleksei-burlakov/test-cicd2
CI/CD: Add 16.1 and tumbleweed to the test mash
2 parents c93b80d + bdcaa40 commit 563236e

7 files changed

Lines changed: 326 additions & 2 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM docker.io/opensuse/tumbleweed
2+
3+
# install deps (hawk2 will pull all the gems, but uglifier)
4+
# libglue-devel is for stonith:external/ssh params hostlist
5+
RUN zypper -n refresh \
6+
&& zypper -n install --no-recommends \
7+
systemd openssh-server \
8+
make gcc pam-devel hawk2 nodejs git policycoreutils \
9+
&& zypper -n clean -a
10+
11+
# allow root password login (specifically for the tests)
12+
RUN sed -i \
13+
-e 's/^#\?PermitRootLogin .*/PermitRootLogin yes/' \
14+
-e 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' \
15+
/usr/etc/ssh/sshd_config
16+
17+
RUN ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa \
18+
&& cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
19+
20+
# unlock root and set password to "linux"
21+
RUN passwd -u root || true && echo -e "linux\nlinux" | passwd root
22+
23+
# start sshd under systemd (`crm cluster init` will start it later anyway)
24+
RUN systemctl enable sshd
25+
26+
# backup the Gemfiles
27+
RUN cp /usr/share/hawk/Gemfile* /
28+
29+
# we need a clean /usr/share/hawk, later we will 'make install' in here
30+
RUN rm -rf /usr/share/hawk
31+
32+
# rm -rf /usr/share/hawk also removes some of the hawk-apiserver, so let's recover them
33+
RUN zypper -n install --no-recommends -f hawk-apiserver
34+
35+
COPY *.patch /
36+
37+
# Make packaged gems available during compilation while retaining system gems.
38+
ENV GEM_PATH=/usr/libexec/hawk/vendor
39+
40+
CMD ["/usr/lib/systemd/systemd", "--system"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/hawk/config/application.rb b/hawk/config/application.rb
2+
--- a/hawk/config/application.rb
3+
+++ b/hawk/config/application.rb
4+
@@ -44,6 +44,11 @@ module Hawk
5+
config.middleware.use Rack::Deflater
6+
end
7+
8+
+ JsRoutes.setup do |config|
9+
+ config.module_type = nil
10+
+ config.namespace = "Routes"
11+
+ end
12+
+
13+
os_release = File.readable?("/etc/os-release") ? File.read("/etc/os-release") : ""
14+
config.x.hawk_is_sles = os_release[/^ID=["']?([^"'\s]+)["']?$/, 1] == "sles"
15+
config.x.hawk_os_version = os_release[/^VERSION_ID=["']?([^"'\s]+)["']?$/, 1]
16+
diff --git a/hawk/config/boot.rb b/hawk/config/boot.rb
17+
--- a/hawk/config/boot.rb
18+
+++ b/hawk/config/boot.rb
19+
@@ -38,7 +38,7 @@ else
20+
gem "virtus", version: "~> 1.0"
21+
require "virtus"
22+
23+
- gem "js-routes", version: ">= 1.3.3"
24+
+ gem "js-routes", version: ">= 2.0.0"
25+
require "js-routes"
26+
27+
gem "fast_gettext", version: "~> 1.4"
28+
diff --git a/hawk/config/environments/development.rb b/hawk/config/environments/development.rb
29+
--- a/hawk/config/environments/development.rb
30+
+++ b/hawk/config/environments/development.rb
31+
@@ -27,7 +27,7 @@ Rails.application.configure do
32+
33+
config.cache_store = :memory_store
34+
35+
- config.assets.debug = true
36+
+ config.assets.debug = false
37+
config.assets.raise_runtime_errors = true
38+
config.assets.js_compressor = nil
39+
config.assets.css_compressor = nil
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/scripts/hawk-backend.service.in b/scripts/hawk-backend.service.in
2+
index aafcadb7..143d6f66 100644
3+
--- a/scripts/hawk-backend.service.in
4+
+++ b/scripts/hawk-backend.service.in
5+
@@ -8,12 +8,10 @@ Type=simple
6+
KillMode=control-group
7+
TimeoutSec=300
8+
TimeoutStopSec=10
9+
-User=hacluster
10+
-Group=haclient
11+
WorkingDirectory=@WWW_BASE@/hawk
12+
Environment="HAWK_ENV=production"
13+
Environment="HAWK_BIND=unix://@WWW_BASE@/hawk/tmp/hawk.sock"
14+
EnvironmentFile=-/etc/sysconfig/hawk
15+
-ExecStart=/usr/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb
16+
-ExecStop=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop
17+
-ExecReload=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart
18+
+ExecStart=/usr/libexec/hawk/vendor/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb
19+
+ExecStop=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop
20+
+ExecReload=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM docker.io/opensuse/leap:16.1
2+
3+
# WORKAROUD: this repo is required only for a newer hawk-apiserver, remove it later when hawk-apiserver is updated
4+
RUN zypper ar -p1 \
5+
https://download.opensuse.org/repositories/home:/aburlakov:/branches:/openSUSE:/Factory:/GITHUB/16.1/home:aburlakov:branches:openSUSE:Factory:GITHUB.repo
6+
7+
# install deps (hawk2 will pull all the gems, but uglifier)
8+
# libglue-devel is for stonith:external/ssh params hostlist
9+
RUN zypper -n --gpg-auto-import-keys refresh \
10+
&& zypper -n install --no-recommends \
11+
systemd openssh-server \
12+
make gcc pam-devel hawk2 nodejs git policycoreutils \
13+
&& zypper -n clean -a
14+
15+
# allow root password login (specifically for the tests)
16+
RUN sed -i \
17+
-e 's/^#\?PermitRootLogin .*/PermitRootLogin yes/' \
18+
-e 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' \
19+
/usr/etc/ssh/sshd_config
20+
21+
RUN ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa \
22+
&& cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
23+
24+
# unlock root and set password to "linux"
25+
RUN passwd -u root || true && echo -e "linux\nlinux" | passwd root
26+
27+
# start sshd under systemd (`crm cluster init` will start it later anyway)
28+
RUN systemctl enable sshd
29+
30+
# backup the Gemfiles
31+
RUN cp /usr/share/hawk/Gemfile* /
32+
33+
# we need a clean /usr/share/hawk, later we will 'make install' in here
34+
RUN rm -rf /usr/share/hawk
35+
36+
# rm -rf /usr/share/hawk also removes some of the hawk-apiserver, so let's recover them
37+
RUN zypper -n install --no-recommends -f hawk-apiserver
38+
39+
COPY *.patch /
40+
41+
# Make packaged gems available during compilation while retaining system gems.
42+
ENV GEM_PATH=/usr/libexec/hawk/vendor
43+
44+
CMD ["/usr/lib/systemd/systemd", "--system"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/hawk/config/application.rb b/hawk/config/application.rb
2+
--- a/hawk/config/application.rb
3+
+++ b/hawk/config/application.rb
4+
@@ -44,6 +44,11 @@ module Hawk
5+
config.middleware.use Rack::Deflater
6+
end
7+
8+
+ JsRoutes.setup do |config|
9+
+ config.module_type = nil
10+
+ config.namespace = "Routes"
11+
+ end
12+
+
13+
os_release = File.readable?("/etc/os-release") ? File.read("/etc/os-release") : ""
14+
config.x.hawk_is_sles = os_release[/^ID=["']?([^"'\s]+)["']?$/, 1] == "sles"
15+
config.x.hawk_os_version = os_release[/^VERSION_ID=["']?([^"'\s]+)["']?$/, 1]
16+
diff --git a/hawk/config/boot.rb b/hawk/config/boot.rb
17+
--- a/hawk/config/boot.rb
18+
+++ b/hawk/config/boot.rb
19+
@@ -38,7 +38,7 @@ else
20+
gem "virtus", version: "~> 1.0"
21+
require "virtus"
22+
23+
- gem "js-routes", version: ">= 1.3.3"
24+
+ gem "js-routes", version: ">= 2.0.0"
25+
require "js-routes"
26+
27+
gem "fast_gettext", version: "~> 1.4"
28+
diff --git a/hawk/config/environments/development.rb b/hawk/config/environments/development.rb
29+
--- a/hawk/config/environments/development.rb
30+
+++ b/hawk/config/environments/development.rb
31+
@@ -27,7 +27,7 @@ Rails.application.configure do
32+
33+
config.cache_store = :memory_store
34+
35+
- config.assets.debug = true
36+
+ config.assets.debug = false
37+
config.assets.raise_runtime_errors = true
38+
config.assets.js_compressor = nil
39+
config.assets.css_compressor = nil
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/scripts/hawk-backend.service.in b/scripts/hawk-backend.service.in
2+
index aafcadb7..143d6f66 100644
3+
--- a/scripts/hawk-backend.service.in
4+
+++ b/scripts/hawk-backend.service.in
5+
@@ -8,12 +8,10 @@ Type=simple
6+
KillMode=control-group
7+
TimeoutSec=300
8+
TimeoutStopSec=10
9+
-User=hacluster
10+
-Group=haclient
11+
WorkingDirectory=@WWW_BASE@/hawk
12+
Environment="HAWK_ENV=production"
13+
Environment="HAWK_BIND=unix://@WWW_BASE@/hawk/tmp/hawk.sock"
14+
EnvironmentFile=-/etc/sysconfig/hawk
15+
-ExecStart=/usr/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb
16+
-ExecStop=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop
17+
-ExecReload=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart
18+
+ExecStart=/usr/libexec/hawk/vendor/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb
19+
+ExecStop=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop
20+
+ExecReload=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart

‎.github/workflows/test-hawk.yaml‎

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: e2e_test for hawk on leap15.6 and leap16.0
1+
name: e2e_test for hawk on leap15.6, leap16.0 and tumbleweed
22
on:
33
push:
44
branches:
@@ -140,7 +140,7 @@ jobs:
140140
run: |
141141
docker exec -i node1 bash -c "cd hawk && make install"
142142
143-
- name: Restore the /usr/share/hawk permissions
143+
- name: Restore the /usr/share/hawk permissions (16.x - specific, no need in tumbleweed)
144144
run: |
145145
docker exec -i node1 bash -c "restorecon -R /usr/share/hawk"
146146
@@ -164,3 +164,125 @@ jobs:
164164
if: always()
165165
run: |
166166
docker rm -f node1 || true
167+
168+
test_leap161:
169+
runs-on: ubuntu-latest
170+
needs: build_examiner
171+
steps:
172+
- name: Check out repository code
173+
uses: actions/checkout@v4
174+
175+
- name: Download hawk-examiner image artifact
176+
uses: actions/download-artifact@v4
177+
with:
178+
name: hawk-examiner-image
179+
180+
- name: Load hawk-examiner image
181+
run: |
182+
docker load -i hawk-examiner.tar
183+
184+
- name: Build hawk-node leap-16.1 image
185+
run: |
186+
docker build -t hawk-node -f .github/docker/hawk-node.leap161/Dockerfile .github/docker/hawk-node.leap161/
187+
188+
- name: Start cluster nodes in containers
189+
run: |
190+
docker run -d --privileged -h node1 --name node1 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node
191+
192+
- name: Copy hawk to the nodes
193+
run: |
194+
docker cp "$GITHUB_WORKSPACE" node1:/
195+
196+
- name: Apply patches and replace Gemfiles
197+
run: |
198+
docker exec -i node1 bash -c "cd hawk && git apply ../*.patch && cp /Gemfile* hawk"
199+
200+
- name: Compile hawk in the nodes
201+
run: |
202+
docker exec -i node1 bash -c "cd hawk && make"
203+
204+
- name: Install hawk in the nodes
205+
run: |
206+
docker exec -i node1 bash -c "cd hawk && make install"
207+
208+
- name: Initialize container on the node1
209+
run: |
210+
docker exec node1 crm cluster init -n cluster3 -y
211+
212+
- name: Check status of hawk
213+
run: |
214+
docker exec node1 systemctl status hawk hawk-backend
215+
216+
- name: Create a stonith-sbd device
217+
run: |
218+
docker exec node1 crm configure primitive fencing-sbd ocf:pacemaker:Dummy
219+
220+
- name: Run the functional test
221+
run: |
222+
docker run --rm hawk-examiner -H ${IP_NODE1} -s linux --xvfb
223+
224+
- name: Cleanup
225+
if: always()
226+
run: |
227+
docker rm -f node1 || true
228+
229+
test_factory:
230+
runs-on: ubuntu-latest
231+
needs: build_examiner
232+
steps:
233+
- name: Check out repository code
234+
uses: actions/checkout@v4
235+
236+
- name: Download hawk-examiner image artifact
237+
uses: actions/download-artifact@v4
238+
with:
239+
name: hawk-examiner-image
240+
241+
- name: Load hawk-examiner image
242+
run: |
243+
docker load -i hawk-examiner.tar
244+
245+
- name: Build hawk-node tumbleweed image
246+
run: |
247+
docker build -t hawk-node -f .github/docker/hawk-node.factory/Dockerfile .github/docker/hawk-node.factory/
248+
249+
- name: Start cluster nodes in containers
250+
run: |
251+
docker run -d --privileged -h node1 --name node1 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node
252+
253+
- name: Copy hawk to the nodes
254+
run: |
255+
docker cp "$GITHUB_WORKSPACE" node1:/
256+
257+
- name: Apply patches and replace Gemfiles
258+
run: |
259+
docker exec -i node1 bash -c "cd hawk && git apply ../*.patch && cp /Gemfile* hawk"
260+
261+
- name: Compile hawk in the nodes
262+
run: |
263+
docker exec -i node1 bash -c "cd hawk && make"
264+
265+
- name: Install hawk in the nodes
266+
run: |
267+
docker exec -i node1 bash -c "cd hawk && make install"
268+
269+
- name: Initialize container on the node1
270+
run: |
271+
docker exec node1 crm cluster init -n cluster4 -y
272+
273+
- name: Check status of hawk
274+
run: |
275+
docker exec node1 systemctl status hawk hawk-backend
276+
277+
- name: Create a stonith-sbd device
278+
run: |
279+
docker exec node1 crm configure primitive fencing-sbd ocf:pacemaker:Dummy
280+
281+
- name: Run the functional test
282+
run: |
283+
docker run --rm hawk-examiner -H ${IP_NODE1} -s linux --xvfb
284+
285+
- name: Cleanup
286+
if: always()
287+
run: |
288+
docker rm -f node1 || true

0 commit comments

Comments
 (0)