Skip to content

Commit

Permalink
parameterise staging CI job for ubuntu version
Browse files Browse the repository at this point in the history
  • Loading branch information
zenmonkeykstop committed Nov 28, 2024
1 parent afdbb6d commit a2ecd5b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ on:

jobs:
staging:
strategy:
matrix:
ubuntu_version: ["focal", "noble"]
runs-on: ubuntu-latest
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
UBUNTU_VERSION: ${{ matrix.ubuntu_version }}
steps:
- uses: actions/checkout@v4
- name: Run staging tests on GCE
Expand Down
3 changes: 2 additions & 1 deletion devops/gce-nested/ci-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ TOPLEVEL="$(git rev-parse --show-toplevel)"
export TOPLEVEL
GCE_CREDS_FILE="${TOPLEVEL}/.gce.creds"
export GCE_CREDS_FILE
export UBUNTU_VERSION="${UBUNTU_VERSION:-focal}"
export BUILD_NUM="${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
export PROJECT_ID="securedrop-ci"
export JOB_NAME="sd-ci-nested"
export GCLOUD_MACHINE_TYPE="c2-standard-8"
export GCLOUD_CONTAINER_VER
export CLOUDSDK_COMPUTE_ZONE="us-west1-c"
export EPHEMERAL_DIRECTORY="/tmp/gce-nested"
export FULL_JOB_ID="${JOB_NAME}-${BUILD_NUM}"
export FULL_JOB_ID="${JOB_NAME}-${UBUNTU_VERSION}-${BUILD_NUM}"
export SSH_USER_NAME=sdci
export SSH_PRIVKEY="${EPHEMERAL_DIRECTORY}/gce"
export SSH_PUBKEY="${SSH_PRIVKEY}.pub"
Expand Down
2 changes: 0 additions & 2 deletions devops/gce-nested/ci-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ set -e
set -u
set -o pipefail

export BASE_OS="${BASE_OS:-focal}"

./devops/gce-nested/gce-start.sh
./devops/gce-nested/gce-runner.sh
./devops/gce-nested/gce-stop.sh
10 changes: 5 additions & 5 deletions devops/gce-nested/gce-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# for storage as artifacts on the build, so devs can review via web.
set -e
set -u
BASE_OS="${BASE_OS:-focal}"
UBUNTU_VERSION="${UBUNTU_VERSION:-focal}"


TOPLEVEL="$(git rev-parse --show-toplevel)"
# shellcheck source=devops/gce-nested/ci-env.sh
. "${TOPLEVEL}/devops/gce-nested/ci-env.sh"

REMOTE_IP="$(gcloud_call compute instances describe \
"${JOB_NAME}-${BUILD_NUM}" \
"${FULL_JOB_ID}" \
--format="value(networkInterfaces[0].accessConfigs.natIP)")"
SSH_TARGET="${SSH_USER_NAME}@${REMOTE_IP}"
SSH_OPTS=(-i "$SSH_PRIVKEY" -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null")
Expand Down Expand Up @@ -56,6 +56,6 @@ copy_securedrop_repo
# so register a trap to ensure the fetch always runs.
trap fetch_junit_test_results EXIT

ssh_gce "make build-debs-notest"
ssh_gce "make build-debs-ossec-notest"
ssh_gce "make staging"
ssh_gce "UBUNTU_VERSION=\"${UBUNTU_VERSION}\" make build-debs-notest"
ssh_gce "UBUNTU_VERSION=\"${UBUNTU_VERSION}\" make build-debs-ossec-notest"
ssh_gce "UBUNTU_VERSION=\"${UBUNTU_VERSION}\" make staging"
2 changes: 1 addition & 1 deletion devops/gce-nested/gce-stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ TOPLEVEL="$(git rev-parse --show-toplevel)"
. "${TOPLEVEL}/devops/gce-nested/ci-env.sh"

# Destroy remote instance
gcloud_call compute instances delete "${JOB_NAME}-${BUILD_NUM}"
gcloud_call compute instances delete "${FULL_JOB_ID}"

0 comments on commit a2ecd5b

Please sign in to comment.