Skip to content

Commit d5e8d9a

Browse files
committed
merge conflicts
2 parents f343f67 + 7d7bc73 commit d5e8d9a

File tree

38 files changed

+688
-194
lines changed

38 files changed

+688
-194
lines changed

.github/workflows/doca.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Test DOCA extra build
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'environments/.stackhpc/terraform/cluster_image.auto.tfvars.json'
9+
- 'ansible/roles/doca/**'
10+
- '.github/workflows/doca'
11+
pull_request:
12+
paths:
13+
- 'environments/.stackhpc/terraform/cluster_image.auto.tfvars.json'
14+
- 'ansible/roles/doca/**'
15+
- '.github/workflows/doca'
16+
17+
jobs:
18+
doca:
19+
name: doca-build
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.image_name }} # to branch/PR + OS
22+
cancel-in-progress: true
23+
runs-on: ubuntu-22.04
24+
strategy:
25+
fail-fast: false # allow other matrix jobs to continue even if one fails
26+
matrix: # build RL8, RL9
27+
build:
28+
- image_name: openhpc-doca-RL8
29+
source_image_name_key: RL8 # key into environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
30+
inventory_groups: doca
31+
- image_name: openhpc-doca-RL9
32+
source_image_name_key: RL9
33+
inventory_groups: doca
34+
env:
35+
ANSIBLE_FORCE_COLOR: True
36+
OS_CLOUD: openstack
37+
CI_CLOUD: ${{ vars.CI_CLOUD }} # default from repo settings
38+
ARK_PASSWORD: ${{ secrets.ARK_PASSWORD }}
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
43+
- name: Load current fat images into GITHUB_ENV
44+
# see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#example-of-a-multiline-string
45+
run: |
46+
{
47+
echo 'FAT_IMAGES<<EOF'
48+
cat environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
49+
echo EOF
50+
} >> "$GITHUB_ENV"
51+
52+
- name: Record settings
53+
run: |
54+
echo CI_CLOUD: ${{ env.CI_CLOUD }}
55+
echo FAT_IMAGES: ${FAT_IMAGES}
56+
57+
- name: Setup ssh
58+
run: |
59+
set -x
60+
mkdir ~/.ssh
61+
echo "${{ secrets[format('{0}_SSH_KEY', env.CI_CLOUD)] }}" > ~/.ssh/id_rsa
62+
chmod 0600 ~/.ssh/id_rsa
63+
shell: bash
64+
65+
- name: Add bastion's ssh key to known_hosts
66+
run: cat environments/.stackhpc/bastion_fingerprints >> ~/.ssh/known_hosts
67+
shell: bash
68+
69+
- name: Install ansible etc
70+
run: dev/setup-env.sh
71+
72+
- name: Write clouds.yaml
73+
run: |
74+
mkdir -p ~/.config/openstack/
75+
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
76+
shell: bash
77+
78+
- name: Setup environment
79+
run: |
80+
. venv/bin/activate
81+
. environments/.stackhpc/activate
82+
83+
- name: Build fat image with packer
84+
id: packer_build
85+
run: |
86+
set -x
87+
. venv/bin/activate
88+
. environments/.stackhpc/activate
89+
cd packer/
90+
packer init .
91+
92+
PACKER_LOG=1 packer build \
93+
-on-error=${{ vars.PACKER_ON_ERROR }} \
94+
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
95+
-var "source_image_name=${{ fromJSON(env.FAT_IMAGES)['cluster_image'][matrix.build.source_image_name_key] }}" \
96+
-var "image_name=${{ matrix.build.image_name }}" \
97+
-var "inventory_groups=${{ matrix.build.inventory_groups }}" \
98+
openstack.pkr.hcl
99+
100+
- name: Get created image names from manifest
101+
id: manifest
102+
run: |
103+
. venv/bin/activate
104+
IMAGE_ID=$(jq --raw-output '.builds[-1].artifact_id' packer/packer-manifest.json)
105+
while ! openstack image show -f value -c name $IMAGE_ID; do
106+
sleep 5
107+
done
108+
IMAGE_NAME=$(openstack image show -f value -c name $IMAGE_ID)
109+
echo "image-name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
110+
echo "image-id=$IMAGE_ID" >> "$GITHUB_OUTPUT"
111+
echo $IMAGE_ID > image-id.txt
112+
echo $IMAGE_NAME > image-name.txt
113+
114+
- name: Make image usable for further builds
115+
run: |
116+
. venv/bin/activate
117+
openstack image unset --property signature_verified "${{ steps.manifest.outputs.image-id }}"
118+
119+
- name: Delete image for automatically-run workflows
120+
run: |
121+
. venv/bin/activate
122+
openstack image delete "${{ steps.manifest.outputs.image-id }}"
123+
if: ${{ github.event_name != 'workflow_dispatch' }}
124+
125+
- name: Upload manifest artifact
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: image-details-${{ matrix.build.image_name }}
129+
path: |
130+
./image-id.txt
131+
./image-name.txt
132+
overwrite: true

.github/workflows/fatimage.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,25 @@ jobs:
1515
openstack:
1616
name: openstack-imagebuild
1717
concurrency:
18-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os_version }}-${{ matrix.build }} # to branch/PR + OS + build
18+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.image_name }} # to branch/PR + OS
1919
cancel-in-progress: true
2020
runs-on: ubuntu-22.04
2121
strategy:
2222
fail-fast: false # allow other matrix jobs to continue even if one fails
2323
matrix: # build RL8, RL9
24-
os_version:
25-
- RL8
26-
- RL9
2724
build:
28-
- openstack.openhpc
25+
- image_name: openhpc-RL8
26+
source_image_name: rocky-latest-RL8
27+
inventory_groups: control,compute,login
28+
- image_name: openhpc-RL9
29+
source_image_name: rocky-latest-RL9
30+
inventory_groups: control,compute,login
2931
env:
3032
ANSIBLE_FORCE_COLOR: True
3133
OS_CLOUD: openstack
3234
CI_CLOUD: ${{ github.event.inputs.ci_cloud }}
33-
SOURCE_IMAGES_MAP: |
34-
{
35-
"RL8": {
36-
"openstack.openhpc": "rocky-latest-RL8"
37-
},
38-
"RL9": {
39-
"openstack.openhpc": "rocky-latest-RL9"
40-
}
41-
}
4235
ARK_PASSWORD: ${{ secrets.ARK_PASSWORD }}
36+
LEAFCLOUD_PULP_PASSWORD: ${{ secrets.LEAFCLOUD_PULP_PASSWORD }}
4337

4438
steps:
4539
- uses: actions/checkout@v2
@@ -85,13 +79,11 @@ jobs:
8579
8680
PACKER_LOG=1 packer build \
8781
-on-error=${{ vars.PACKER_ON_ERROR }} \
88-
-only=${{ matrix.build }} \
8982
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
90-
-var "source_image_name=${{ env.SOURCE_IMAGE }}" \
83+
-var "source_image_name=${{ matrix.build.source_image_name }}" \
84+
-var "image_name=${{ matrix.build.image_name }}" \
85+
-var "inventory_groups=${{ matrix.build.inventory_groups }}" \
9186
openstack.pkr.hcl
92-
env:
93-
PKR_VAR_os_version: ${{ matrix.os_version }}
94-
SOURCE_IMAGE: ${{ fromJSON(env.SOURCE_IMAGES_MAP)[matrix.os_version][matrix.build] }}
9587
9688
- name: Get created image names from manifest
9789
id: manifest
@@ -102,13 +94,20 @@ jobs:
10294
sleep 5
10395
done
10496
IMAGE_NAME=$(openstack image show -f value -c name $IMAGE_ID)
97+
echo "image-name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
98+
echo "image-id=$IMAGE_ID" >> "$GITHUB_OUTPUT"
10599
echo $IMAGE_ID > image-id.txt
106100
echo $IMAGE_NAME > image-name.txt
107101
102+
- name: Make image usable for further builds
103+
run: |
104+
. venv/bin/activate
105+
openstack image unset --property signature_verified "${{ steps.manifest.outputs.image-id }}"
106+
108107
- name: Upload manifest artifact
109108
uses: actions/upload-artifact@v4
110109
with:
111-
name: image-details-${{ matrix.build }}-${{ matrix.os_version }}
110+
name: image-details-${{ matrix.build.image_name }}
112111
path: |
113112
./image-id.txt
114113
./image-name.txt

.github/workflows/nightlybuild.yml

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,31 @@ on:
1111
- SMS
1212
- ARCUS
1313
schedule:
14-
- cron: '0 0 * * *' # Run at midnight
14+
- cron: '0 0 * * *' # Run at midnight on default branch
1515

1616
jobs:
1717
openstack:
1818
name: openstack-imagebuild
1919
concurrency:
20-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os_version }}-${{ matrix.build }} # to branch/PR + OS + build
20+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.image_name }} # to branch/PR + OS
2121
cancel-in-progress: true
2222
runs-on: ubuntu-22.04
2323
strategy:
2424
fail-fast: false # allow other matrix jobs to continue even if one fails
2525
matrix: # build RL8, RL9
26-
os_version:
27-
- RL8
28-
- RL9
2926
build:
30-
- openstack.rocky-latest
27+
- image_name: rocky-latest-RL8
28+
source_image_name: Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2
29+
inventory_groups: update
30+
- image_name: rocky-latest-RL9
31+
source_image_name: Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2
32+
inventory_groups: update
3133
env:
3234
ANSIBLE_FORCE_COLOR: True
3335
OS_CLOUD: openstack
3436
CI_CLOUD: ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
35-
SOURCE_IMAGES_MAP: |
36-
{
37-
"RL8": "Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2",
38-
"RL9": "Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2"
39-
}
4037
ARK_PASSWORD: ${{ secrets.ARK_PASSWORD }}
38+
LEAFCLOUD_PULP_PASSWORD: ${{ secrets.LEAFCLOUD_PULP_PASSWORD }}
4139

4240
steps:
4341
- uses: actions/checkout@v2
@@ -83,15 +81,13 @@ jobs:
8381
8482
PACKER_LOG=1 packer build \
8583
-on-error=${{ vars.PACKER_ON_ERROR }} \
86-
-only=${{ matrix.build }} \
8784
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
88-
-var "source_image_name=${{ env.SOURCE_IMAGE }}" \
85+
-var "source_image_name=${{ matrix.build.source_image_name }}" \
86+
-var "image_name=${{ matrix.build.image_name }}" \
87+
-var "image_name_version=" \
88+
-var "inventory_groups=${{ matrix.build.inventory_groups }}" \
8989
openstack.pkr.hcl
9090
91-
env:
92-
PKR_VAR_os_version: ${{ matrix.os_version }}
93-
SOURCE_IMAGE: ${{ fromJSON(env.SOURCE_IMAGES_MAP)[matrix.os_version] }}
94-
9591
- name: Get created image names from manifest
9692
id: manifest
9793
run: |
@@ -125,7 +121,7 @@ jobs:
125121
name: upload-nightly-targets
126122
needs: openstack
127123
concurrency:
128-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os_version }}-${{ matrix.image }}-${{ matrix.target_cloud }}
124+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.image_name }}-${{ matrix.target_cloud }}
129125
cancel-in-progress: true
130126
runs-on: ubuntu-22.04
131127
strategy:
@@ -135,18 +131,15 @@ jobs:
135131
- LEAFCLOUD
136132
- SMS
137133
- ARCUS
138-
os_version:
139-
- RL8
140-
- RL9
141-
image:
142-
- rocky-latest
134+
build:
135+
- image_name: rocky-latest-RL8
136+
- image_name: rocky-latest-RL9
143137
exclude:
144138
- target_cloud: LEAFCLOUD
145139
env:
146140
OS_CLOUD: openstack
147141
SOURCE_CLOUD: ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
148142
TARGET_CLOUD: ${{ matrix.target_cloud }}
149-
IMAGE_NAME: "${{ matrix.image }}-${{ matrix.os_version }}"
150143
steps:
151144
- uses: actions/checkout@v2
152145

@@ -161,42 +154,37 @@ jobs:
161154
. venv/bin/activate
162155
pip install -U pip
163156
pip install $(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)
164-
shell: bash
165157
166158
- name: Write clouds.yaml
167159
run: |
168160
mkdir -p ~/.config/openstack/
169161
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.SOURCE_CLOUD)] }}" > ~/.config/openstack/source_clouds.yaml
170162
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.TARGET_CLOUD)] }}" > ~/.config/openstack/target_clouds.yaml
171-
shell: bash
172163
173164
- name: Download source image
174165
run: |
175166
. venv/bin/activate
176167
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/source_clouds.yaml
177-
openstack image save --file ${{ env.IMAGE_NAME }} ${{ env.IMAGE_NAME }}
178-
shell: bash
168+
openstack image save --file ${{ matrix.build.image_name }} ${{ matrix.build.image_name }}
179169
180170
- name: Upload to target cloud
181171
run: |
182172
. venv/bin/activate
183173
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
184174
185-
openstack image create "${{ env.IMAGE_NAME }}" \
186-
--file "${{ env.IMAGE_NAME }}" \
175+
openstack image create "${{ matrix.build.image_name }}" \
176+
--file "${{ matrix.build.image_name }}" \
187177
--disk-format qcow2 \
188-
shell: bash
189178
190179
- name: Delete old latest image from target cloud
191180
run: |
192181
. venv/bin/activate
193182
export OS_CLIENT_CONFIG_FILE=~/.config/openstack/target_clouds.yaml
194183
195-
IMAGE_COUNT=$(openstack image list --name ${{ env.IMAGE_NAME }} -f value -c ID | wc -l)
184+
IMAGE_COUNT=$(openstack image list --name ${{ matrix.build.image_name }} -f value -c ID | wc -l)
196185
if [ "$IMAGE_COUNT" -gt 1 ]; then
197-
OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ env.IMAGE_NAME }}" -f value -c ID | head -n 1)
186+
OLD_IMAGE_ID=$(openstack image list --sort created_at:asc --name "${{ matrix.build.image_name }}" -f value -c ID | head -n 1)
198187
openstack image delete "$OLD_IMAGE_ID"
199188
else
200189
echo "Only one image exists, skipping deletion."
201190
fi
202-
shell: bash

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ It requires an OpenStack cloud, and an Ansible "deploy host" with access to that
3232
Before starting ensure that:
3333
- You have root access on the deploy host.
3434
- You can create instances using a Rocky 9 GenericCloud image (or an image based on that).
35-
- **NB**: In general it is recommended to use the [latest released image](https://github.com/stackhpc/ansible-slurm-appliance/releases) which already contains the required packages. This is built and tested in StackHPC's CI. However the appliance will install the necessary packages if a GenericCloud image is used.
35+
- **NB**: In general it is recommended to use the [latest released image](https://github.com/stackhpc/ansible-slurm-appliance/releases) which already contains the required packages. This is built and tested in StackHPC's CI.
3636
- You have a SSH keypair defined in OpenStack, with the private key available on the deploy host.
3737
- Created instances have access to internet (note proxies can be setup through the appliance if necessary).
3838
- Created instances have accurate/synchronised time (for VM instances this is usually provided by the hypervisor; if not or for bare metal instances it may be necessary to configure a time service via the appliance).

ansible/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ roles/*
6666
!roles/lustre/**
6767
!roles/dnf_repos/
6868
!roles/dnf_repos/**
69+
!roles/pulp_site/
70+
!roles/pulp_site/**
71+
!roles/doca/
72+
!roles/doca/**

ansible/adhoc/deploy-pulp.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Usage: ansible-playbook ansible/adhoc/deploy-pulp.yml -e "pulp_server=<pulp server hostname>"
2+
3+
- name: Add temporary pulp server host
4+
hosts: localhost
5+
tasks:
6+
- ansible.builtin.add_host:
7+
name: "{{ pulp_server }}"
8+
group: "_pulp_host"
9+
10+
- name: Install pulp on server and add to config
11+
become: yes
12+
hosts: _pulp_host
13+
tasks:
14+
15+
- name: Install pulp
16+
ansible.builtin.include_role:
17+
name: pulp_site
18+
tasks_from: install.yml
19+
public: true
20+
21+
- name: Print Pulp endpoint
22+
become: no
23+
debug:
24+
msg: |
25+
Server configured, override 'appliances_pulp_url' with
26+
appliances_pulp_url: "http://{{ pulp_server }}:{{ pulp_site_port }}"
27+
in your environments

0 commit comments

Comments
 (0)