Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SMS Labs for CI #426

Merged
merged 22 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .github/workflows/fatimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
name: Build fat image
'on':
workflow_dispatch:
inputs:
ci_cloud:
description: 'Select the CI_CLOUD'
required: true
type: choice
options:
bertiethorpe marked this conversation as resolved.
Show resolved Hide resolved
- LEAFCLOUD
- SMS
- ARCUS
concurrency:
group: ${{ github.ref }}-{{ matrix.os_version }}-{{ matrix.build }} # to branch/PR + OS + build
cancel-in-progress: true
Expand All @@ -25,15 +34,19 @@ jobs:
env:
ANSIBLE_FORCE_COLOR: True
OS_CLOUD: openstack
CI_CLOUD: ${{ vars.CI_CLOUD }}
CI_CLOUD: ${{ github.event.inputs.ci_cloud }}
steps:
- uses: actions/checkout@v2

- name: Record settings for CI cloud
run: |
echo CI_CLOUD: ${{ env.CI_CLOUD }}

- name: Setup ssh
run: |
set -x
mkdir ~/.ssh
echo "${{ secrets[format('{0}_SSH_KEY', vars.CI_CLOUD)] }}" > ~/.ssh/id_rsa
echo "${{ secrets[format('{0}_SSH_KEY', env.CI_CLOUD)] }}" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
shell: bash

Expand All @@ -47,7 +60,7 @@ jobs:
- name: Write clouds.yaml
run: |
mkdir -p ~/.config/openstack/
echo "${{ secrets[format('{0}_CLOUDS_YAML', vars.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
shell: bash

- name: Setup environment
Expand All @@ -62,7 +75,7 @@ jobs:
. environments/.stackhpc/activate
cd packer/
packer init .
PACKER_LOG=1 packer build -on-error=${{ vars.PACKER_ON_ERROR }} -only=${{ matrix.build }} -var-file=$PKR_VAR_environment_root/${{ vars.CI_CLOUD }}.pkrvars.hcl openstack.pkr.hcl
PACKER_LOG=1 packer build -on-error=${{ vars.PACKER_ON_ERROR }} -only=${{ matrix.build }} -var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl openstack.pkr.hcl
env:
PKR_VAR_os_version: ${{ matrix.os_version }}

Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/stackhpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,33 @@ jobs:
ANSIBLE_FORCE_COLOR: True
OS_CLOUD: openstack
TF_VAR_cluster_name: slurmci-${{ matrix.os_version }}-${{ github.run_number }}
CI_CLOUD: ${{ vars.CI_CLOUD }}
CI_CLOUD: ${{ vars.CI_CLOUD }} # default from repo settings
steps:
- uses: actions/checkout@v2

- name: Override CI_CLOUD if PR label is present
if: ${{ github.event_name == 'pull_request' }}
run: |
# Iterate over the labels
labels=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -r '.[].name')
echo $labels
for label in $labels; do
if [[ $label == CI_CLOUD=* ]]; then
# Extract the value after 'CI_CLOUD='
CI_CLOUD_OVERRIDE=${label#CI_CLOUD=}
echo "CI_CLOUD=${CI_CLOUD_OVERRIDE}" >> $GITHUB_ENV
fi
done

- name: Record settings for CI cloud
run: |
echo CI_CLOUD: ${{ vars.CI_CLOUD }}
echo CI_CLOUD: ${{ env.CI_CLOUD }}

- name: Setup ssh
run: |
set -x
mkdir ~/.ssh
echo "${{ secrets[format('{0}_SSH_KEY', vars.CI_CLOUD)] }}" > ~/.ssh/id_rsa
echo "${{ secrets[format('{0}_SSH_KEY', env.CI_CLOUD)] }}" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
shell: bash

Expand All @@ -70,7 +84,7 @@ jobs:
- name: Write clouds.yaml
run: |
mkdir -p ~/.config/openstack/
echo "${{ secrets[format('{0}_CLOUDS_YAML', vars.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
shell: bash

- name: Setup environment-specific inventory/terraform inputs
Expand All @@ -88,7 +102,7 @@ jobs:
. venv/bin/activate
. environments/.stackhpc/activate
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
terraform apply -auto-approve -var-file="${{ vars.CI_CLOUD }}.tfvars"
terraform apply -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
env:
TF_VAR_os_version: ${{ matrix.os_version }}

Expand All @@ -97,7 +111,7 @@ jobs:
. venv/bin/activate
. environments/.stackhpc/activate
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
terraform destroy -auto-approve -var-file="${{ vars.CI_CLOUD }}.tfvars"
terraform destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
if: failure() && steps.provision_servers.outcome == 'failure'
env:
TF_VAR_os_version: ${{ matrix.os_version }}
Expand Down Expand Up @@ -197,7 +211,7 @@ jobs:
. venv/bin/activate
. environments/.stackhpc/activate
cd $APPLIANCES_ENVIRONMENT_ROOT/terraform
terraform destroy -auto-approve -var-file="${{ vars.CI_CLOUD }}.tfvars"
terraform destroy -auto-approve -var-file="${{ env.CI_CLOUD }}.tfvars"
if: ${{ success() || cancelled() }}
env:
TF_VAR_os_version: ${{ matrix.os_version }}
Expand Down
3 changes: 0 additions & 3 deletions environments/.stackhpc/ARCUS.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
flavor = "vm.ska.cpu.general.small"
use_blockstorage_volume = true
volume_size = 15 # GB
image_disk_format = "qcow2"
networks = ["4b6b2722-ee5b-40ec-8e52-a6610e14cc51"] # portal-internal (DNS broken on ilab-60)
ssh_keypair_name = "slurm-app-ci"
ssh_private_key_file = "~/.ssh/id_rsa"
Expand Down
3 changes: 0 additions & 3 deletions environments/.stackhpc/LEAFCLOUD.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
flavor = "ec1.large"
use_blockstorage_volume = true
volume_size = 15 # GB
volume_type = "unencrypted"
image_disk_format = "qcow2"
networks = ["909e49e8-6911-473a-bf88-0495ca63853c"] # slurmapp-ci
ssh_keypair_name = "slurm-app-ci"
ssh_private_key_file = "~/.ssh/id_rsa"
Expand Down
7 changes: 7 additions & 0 deletions environments/.stackhpc/SMS.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
flavor = "general.v1.small"
networks = ["e2b9e59f-43da-4e1c-b558-dc9da4c0d738"] # stackhpc-ipv4-geneve
ssh_keypair_name = "slurm-app-ci"
ssh_private_key_file = "~/.ssh/id_rsa"
ssh_bastion_username = "slurm-app-ci"
ssh_bastion_host = "185.45.78.150"
ssh_bastion_private_key_file = "~/.ssh/id_rsa"
5 changes: 4 additions & 1 deletion environments/.stackhpc/bastion_fingerprints
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
|1|whGSPLhKW4xt/7PWOZ1treg3PtA=|F5gwV8j0JYWDzjb6DvHHaqO+sxs= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCpCG881Gt3dr+nuVIC2uGEQkeVwG6WDdS1WcCoxXC7AG+Oi5bfdqtf4IfeLpWmeuEaAaSFH48ODFr76ViygSjU=
|1|0V6eQ1FKO5NMKaHZeNFbw62mrJs=|H1vuGTbbtZD2MEgZxQf1PXPk+yU= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEnOtYByM3s2qvRT8SS1sn5z5sbwjzb1alm0B3emPcHJ
|1|u3QVAK9R2x7Z3uKNj+0vDEIekl0=|yy09Q0Kw472+J7bjFkmir28x3lE= ssh-ed25519 AAAAC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C3NzaC1lZDI1NTE5AAAAINNuXZkH7ppkTGNGKzmGEvAnvlLO2D+YtlJw1m3P16FV
3 changes: 3 additions & 0 deletions environments/.stackhpc/inventory/group_vars/all/bastion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ bastion_config:
LEAFCLOUD:
user: slurm-app-ci
ip: 195.114.30.222
SMS:
user: slurm-app-ci
ip: 185.45.78.150
# NB: The bastion_{user,ip} variables are used directly in the CI workflow too
bastion_user: "{{ bastion_config[ci_cloud].user }}"
bastion_ip: "{{ bastion_config[ci_cloud].ip }}"
Expand Down
4 changes: 4 additions & 0 deletions environments/.stackhpc/terraform/SMS.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cluster_net = "stackhpc-ipv4-geneve"
cluster_subnet = "stackhpc-ipv4-geneve-subnet"
control_node_flavor = "general.v1.small"
other_node_flavor = "general.v1.small"
6 changes: 3 additions & 3 deletions packer/openstack.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ variable "manifest_output_path" {

variable "use_blockstorage_volume" {
type = bool
default = false
default = true
}

variable "volume_type" {
Expand All @@ -130,12 +130,12 @@ variable "volume_type" {

variable "volume_size" {
type = number
default = null # When not specified use the size of the builder instance root disk
default = 15
}

variable "image_disk_format" {
type = string
default = null # When not specified use the image default
default = "qcow2"
}

variable "metadata" {
Expand Down
Loading