Skip to content

Commit 8e18b72

Browse files
committed
Merge branch 'improvement/add-missing-lifecyle-test-in-nightly' into tmp/octopus/w/125.0/improvement/add-missing-lifecyle-test-in-nightly
2 parents cd7da6d + 18309f9 commit 8e18b72

File tree

9 files changed

+565
-17
lines changed

9 files changed

+565
-17
lines changed

.github/actions/destroy-cluster/action.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ inputs:
88
required: true
99
ARTIFACTS_USER:
1010
description: "Scality Artifacts username"
11-
required: true
11+
required: false
1212
ARTIFACTS_PASSWORD:
1313
description: "Scality Artifacts password"
14-
required: true
14+
required: false
1515

1616
# Tooling configuration
1717
TERRAFORM_VERSION:
@@ -28,8 +28,8 @@ inputs:
2828

2929
# Spawn configuration
3030
ARTIFACTS_URL:
31-
description: Full URL to the saved Terraform context
32-
required: true
31+
description: Full URL to the saved Terraform context (if empty consider that context already there)
32+
required: false
3333
NAME:
3434
description: "Name of the deployment (used in artifacts and the VM names prefix)"
3535
required: true
@@ -38,25 +38,30 @@ runs:
3838
using: "composite"
3939
steps:
4040
- name: Checkout terraform-snapshot
41+
if: inputs.ARTIFACTS_URL
4142
uses: actions/checkout@v3
4243
with:
4344
repository: scality/terraform-snapshot
4445
path: terraform-snapshot
4546
token: ${{ inputs.GIT_ACCESS_TOKEN }}
4647
ref: "${{ inputs.TERRAFORM_SNAPSHOT_TAG }}"
4748
- name: Install tools
49+
if: inputs.ARTIFACTS_URL
4850
shell: bash
4951
run: sudo yum install -y unzip
5052
- name: Install node
53+
if: inputs.ARTIFACTS_URL
5154
uses: actions/setup-node@v3
5255
with:
5356
node-version: "14"
5457
- name: Install Terraform
58+
if: inputs.ARTIFACTS_URL
5559
uses: hashicorp/setup-terraform@v2
5660
with:
5761
terraform_version: ${{ inputs.TERRAFORM_VERSION }}
5862
terraform_wrapper: false
5963
- name: Retrieve Terraform context and SSH keys
64+
if: inputs.ARTIFACTS_URL
6065
working-directory: terraform-snapshot/terraform/
6166
shell: bash
6267
run: |
@@ -69,6 +74,7 @@ runs:
6974
curl -LO -u ${{ inputs.ARTIFACTS_USER }}:${{ inputs.ARTIFACTS_PASSWORD }} \
7075
"${{ inputs.ARTIFACTS_URL }}/terraform-context/${{ inputs.NAME }}/ssh_config"
7176
- name: Unpack Terraform context and move SSH keys
77+
if: inputs.ARTIFACTS_URL
7278
working-directory: terraform-snapshot/terraform/
7379
shell: bash
7480
run: |

.github/actions/prepare-bastion/action.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ runs:
1818
uses: ./.github/actions/run-command-ssh
1919
with:
2020
NODE: bastion
21-
COMMAND: >
22-
git clone --depth 1
23-
--branch ${{ inputs.BRANCH }}
24-
${{ github.server_url }}/${{ github.repository }}
21+
COMMAND: |
22+
if [ -d 'metalk8s' ]; then
23+
cd metalk8s && git checkout ${{ inputs.BRANCH }}
24+
else
25+
git clone --branch ${{ inputs.BRANCH }} \
26+
${{ github.server_url }}/${{ github.repository }}
27+
fi
2528
- name: Install UI tests deps on Bastion
2629
if: inputs.UI_DEPS != 'false'
2730
uses: ./.github/actions/run-command-ssh
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Run Downgrade"
2+
description: "Run the downgrade script on bootstrap node"
3+
4+
inputs:
5+
version:
6+
description: "The MetalK8s version to downgrade to"
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: "Retrieve MetalK8s mountpoint"
13+
id: metalk8s_mountpoint
14+
uses: ./.github/actions/retrieve-mountpoint
15+
- name: Run Downgrade script
16+
uses: ./.github/actions/run-command-ssh
17+
with:
18+
COMMAND: >
19+
sudo ${{ steps.metalk8s_mountpoint.outputs.mountpoint }}/downgrade.sh
20+
--destination-version ${{ inputs.version }} --verbose

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
uses: actions/checkout@v3
3535
with:
3636
ref: ${{ inputs.ref }}
37+
# NOTE: We fetch depth so that we can put the right `GIT` reference
38+
# in the product.txt
39+
fetch-depth: 0
3740
- name: Set up Docker Buildx
3841
uses: docker/setup-buildx-action@v2
3942
- name: Install Python 3

.github/workflows/downgrade-test.yaml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Downgrade test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
from-artifacts-url:
7+
description: "Artifacts URL to use to install"
8+
required: true
9+
type: string
10+
to-artifacts-url:
11+
description: "Artifacts URL to downgrade to"
12+
required: true
13+
type: string
14+
type:
15+
description: "The type of downgrade ran"
16+
required: false
17+
type: string
18+
default: "unknown"
19+
20+
env:
21+
CLOUD: "ovh"
22+
OS: "rocky-8"
23+
TERRAFORM_VERSION: "1.3.6"
24+
TERRAFORM_SNAPSHOT_TAG: "0.9.0"
25+
NODES_COUNT: "0"
26+
27+
jobs:
28+
downgrade:
29+
runs-on: [self-hosted, centos7, large]
30+
env:
31+
NAME: downgrade-${{ inputs.type }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v3
35+
- name: Install deps
36+
run: sudo yum install -y isomd5sum
37+
38+
## Spawn {{{
39+
- name: Export environment variables for accessing ${{ env.CLOUD }}
40+
uses: ./.github/actions/export-cloud-env
41+
with:
42+
CLOUD: ${{ env.CLOUD }}
43+
# Pass all "cloud access" secrets, the action will know which ones to export
44+
OVH_AUTH_URL: ${{ secrets.OVH_AUTH_URL }}
45+
OVH_USERNAME: ${{ secrets.OVH_USERNAME }}
46+
OVH_PASSWORD: ${{ secrets.OVH_PASSWORD }}
47+
OVH_REGION: ${{ secrets.OVH_REGION }}
48+
- name: Spawn cluster with Terraform
49+
uses: ./.github/actions/spawn-cluster
50+
with:
51+
# Parameters
52+
CLOUD: ${{ env.CLOUD }}
53+
OS: ${{ env.OS }}
54+
NAME: ${{ env.NAME }}
55+
NODES_COUNT: ${{ env.NODES_COUNT }}
56+
TERRAFORM_VERSION: ${{ env.TERRAFORM_VERSION }}
57+
TERRAFORM_SNAPSHOT_TAG: ${{ env.TERRAFORM_SNAPSHOT_TAG }}
58+
# Secrets
59+
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
60+
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
61+
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
62+
- name: Save Terraform context
63+
if: always()
64+
uses: ./.github/actions/save-terraform-context
65+
with:
66+
NAME: ${{ env.NAME }}
67+
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
68+
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
69+
- name: Copy SSH config to current directory
70+
run: cp terraform-snapshot/terraform/ssh_config ./
71+
## }}}
72+
73+
# Install source {{{
74+
- name: Get source MetalK8s ISO
75+
uses: ./.github/actions/retrieve-iso
76+
with:
77+
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
78+
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
79+
ARTIFACTS_URL: ${{ inputs.from-artifacts-url }}
80+
- name: Copy MetalK8s ISO to the Bootstrap node
81+
uses: ./.github/actions/copy-file-ssh
82+
with:
83+
SOURCE_FILE: "metalk8s.iso"
84+
- name: Generate Bootstrap config
85+
uses: ./.github/actions/generate-bootstrap
86+
- name: Mount MetalK8s ISO
87+
uses: ./.github/actions/mount-iso
88+
- name: Run Bootstrap
89+
uses: ./.github/actions/run-bootstrap
90+
- name: Provision volumes
91+
uses: ./.github/actions/provision-volumes
92+
- name: Untaint bootstrap node
93+
uses: ./.github/actions/untaint
94+
# }}}
95+
96+
# Tests source {{{
97+
- name: Wait for pods to stabilize
98+
uses: ./.github/actions/wait-pod-stable
99+
- name: Prepare bastion to run tests
100+
uses: ./.github/actions/prepare-bastion
101+
- name: Run tests from Bastion
102+
uses: ./.github/actions/bastion-tests
103+
# }}}
104+
105+
# Downgrade {{{
106+
- name: Get target MetalK8s ISO
107+
uses: ./.github/actions/retrieve-iso
108+
with:
109+
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
110+
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
111+
ARTIFACTS_URL: ${{ inputs.to-artifacts-url }}
112+
- name: Retrieve target product.txt from artifacts
113+
run: >
114+
curl --fail -LO -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }}
115+
${{ inputs.to-artifacts-url }}/product.txt
116+
- name: Save target version and git commit in environment
117+
run: |
118+
source product.txt
119+
echo "target_version=$VERSION" >> $GITHUB_ENV
120+
echo "target_git_commit=$GIT" >>$GITHUB_ENV
121+
- name: Copy target MetalK8s ISO to the Bootstrap node
122+
uses: ./.github/actions/copy-file-ssh
123+
with:
124+
SOURCE_FILE: "metalk8s.iso"
125+
DESTINATION_FILE: "metalk8s-${{ env.target_version }}.iso"
126+
- name: Add new ISO to the cluster
127+
uses: ./.github/actions/add-archive
128+
with:
129+
archive: "metalk8s-${{ env.target_version }}.iso"
130+
- name: Run the downgrade
131+
uses: ./.github/actions/run-downgrade
132+
with:
133+
version: ${{ env.target_version }}
134+
# }}}
135+
136+
# Tests target {{{
137+
- name: Wait for pods to stabilize
138+
uses: ./.github/actions/wait-pod-stable
139+
- name: Prepare bastion to run ${{ env.target_version }} tests
140+
uses: ./.github/actions/prepare-bastion
141+
with:
142+
BRANCH: ${{ env.target_git_commit }}
143+
- name: Run ${{ env.target_version }} tests from Bastion
144+
uses: ./.github/actions/bastion-tests
145+
# }}}
146+
147+
## Collect logs {{
148+
- name: Generate and Collect sosreport
149+
if: always()
150+
uses: ./.github/actions/sosreport-logs
151+
with:
152+
NODES_COUNT: "${{ env.NODES_COUNT }}"
153+
## }}
154+
155+
## Generate job result {{
156+
- name: Generate Job result
157+
if: always()
158+
uses: ./.github/actions/generate-job-result
159+
with:
160+
name: ${{ env.NAME }}
161+
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
162+
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
163+
GIT_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164+
## }}
165+
166+
## Upload artifacts {{
167+
- name: Upload artifacts
168+
if: always()
169+
uses: scality/action-artifacts@v3
170+
with:
171+
method: upload
172+
url: https://artifacts.scality.net
173+
user: ${{ secrets.ARTIFACTS_USER }}
174+
password: ${{ secrets.ARTIFACTS_PASSWORD }}
175+
source: artifacts
176+
## }}
177+
178+
## Destroy {{{
179+
- name: Destroy cluster with Terraform
180+
if: always()
181+
uses: ./.github/actions/destroy-cluster
182+
with:
183+
# Parameters
184+
CLOUD: ${{ env.CLOUD }}
185+
TERRAFORM_SNAPSHOT_TAG: ${{ env.TERRAFORM_SNAPSHOT_TAG }}
186+
TERRAFORM_VERSION: ${{ env.TERRAFORM_VERSION }}
187+
NAME: ${{ env.NAME }}
188+
# Secrets
189+
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
190+
# }}}

.github/workflows/lifecycle-dev.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Lifecycle dev
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
artifacts-url:
7+
description: "Artifacts URL"
8+
required: true
9+
type: string
10+
dev-branch:
11+
description: "The development branch to use (as source for upgrade and destination for downgrade)"
12+
required: true
13+
type: string
14+
type:
15+
description: "The type of lifecyle ran"
16+
required: false
17+
type: string
18+
default: "unknown"
19+
20+
env:
21+
CLOUD: "ovh"
22+
OS: "rocky-8"
23+
TERRAFORM_VERSION: "1.3.6"
24+
TERRAFORM_SNAPSHOT_TAG: "0.9.0"
25+
26+
jobs:
27+
get-dev-artifacts-url:
28+
runs-on: ubuntu-22.04
29+
outputs:
30+
artifacts-url: ${{ steps.artifacts.outputs.link }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
with:
35+
ref: ${{ inputs.dev-branch }}
36+
- name: Retrieve artifacts url
37+
uses: scality/action-artifacts@v3
38+
id: artifacts
39+
with:
40+
method: get
41+
workflow-name: Pre-merge
42+
url: https://artifacts.scality.net
43+
user: ${{ secrets.ARTIFACTS_USER }}
44+
password: ${{ secrets.ARTIFACTS_PASSWORD }}
45+
46+
dev-upgrade:
47+
needs:
48+
- get-dev-artifacts-url
49+
uses: ./.github/workflows/upgrade-test.yaml
50+
secrets: inherit
51+
with:
52+
from-artifacts-url: ${{ needs.get-dev-artifacts-url.outputs.artifacts-url }}
53+
to-artifacts-url: ${{ inputs.artifacts-url }}
54+
type: ${{ inputs.type }}-dev
55+
56+
dev-downgrade:
57+
needs:
58+
- get-dev-artifacts-url
59+
uses: ./.github/workflows/downgrade-test.yaml
60+
secrets: inherit
61+
with:
62+
from-artifacts-url: ${{ inputs.artifacts-url }}
63+
to-artifacts-url: ${{ needs.get-dev-artifacts-url.outputs.artifacts-url }}
64+
type: ${{ inputs.type }}-dev

.github/workflows/lifecycle-promoted.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ jobs:
6969
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
7070
- name: Save Terraform context
7171
if: always()
72-
id: artifacts
7372
uses: ./.github/actions/save-terraform-context
7473
with:
7574
NAME: ${{ env.NAME }}
@@ -209,10 +208,15 @@ jobs:
209208
CLOUD: ${{ env.CLOUD }}
210209
TERRAFORM_SNAPSHOT_TAG: ${{ env.TERRAFORM_SNAPSHOT_TAG }}
211210
TERRAFORM_VERSION: ${{ env.TERRAFORM_VERSION }}
212-
ARTIFACTS_URL: ${{ steps.artifacts.outputs.link }}
213211
NAME: ${{ env.NAME }}
214212
# Secrets
215213
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
216-
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
217-
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
218214
# }}}
215+
216+
promoted-downgrade:
217+
uses: ./.github/workflows/downgrade-test.yaml
218+
secrets: inherit
219+
with:
220+
from-artifacts-url: ${{ inputs.artifacts-url }}
221+
to-artifacts-url: https://artifacts.scality.net/builds/github:scality:metalk8s:promoted-${{ inputs.promoted-version }}
222+
type: ${{ inputs.type }}

0 commit comments

Comments
 (0)