Skip to content

Commit 3567aac

Browse files
authored
ci(build): Add runners selection (#1299)
* ci(build): Add runners selection * ci(build): Use jq to produce JSOn without newlines * ci(build): Remove superfluous cat from command * temp(ci/opa): Use only Ubicloud runners This ensures that the build succeeds with the set of Ubicloud runners specified in the JSON file. * Revert "temp(ci/opa): Use only Ubicloud runners" This reverts commit 15ef0fb. * ci(opensearch-dashboards): Use Ubicloud runners * chore: Update actionlint config file * chore: Update badges in README * Revert "chore: Update badges in README" This reverts commit de22cd1. This needs to be reverted, because it doesn't pass CI even though it passes locally for me. With this reverted, it will fail locally again. This is very curious, because any differences in file sorting sue to different shells should be accounted for by the bash shebang in the script.
1 parent 1950f63 commit 3567aac

File tree

5 files changed

+66
-12
lines changed

5 files changed

+66
-12
lines changed

.github/actionlint.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
self-hosted-runner:
33
# Ubicloud machines we are using
44
labels:
5-
- ubicloud-standard-8-arm
5+
- ubicloud-standard-8-arm-ubuntu-2404
6+
- ubicloud-standard-8-ubuntu-2404

.github/workflows/build_opensearch_dashboards.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ run-name: |
66
on:
77
workflow_dispatch:
88
schedule:
9-
- cron: '0 0 2/2 * *' # https://crontab.guru/#0_0_2/2_*_*
9+
- cron: "0 0 2/2 * *" # https://crontab.guru/#0_0_2/2_*_*
1010
push:
1111
branches: [main]
1212
tags:
@@ -34,3 +34,4 @@ jobs:
3434
product-name: opensearch-dashboards
3535
sdp-version: ${{ github.ref_type == 'tag' && github.ref_name || '0.0.0-dev' }}
3636
registry-namespace: sdp
37+
runners: ubicloud

.github/workflows/reusable_build_image.yaml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ on:
1010
registry-namespace:
1111
required: true
1212
type: string
13+
runners:
14+
description: |
15+
The type of runners used.
16+
- `mixed`: x86_64 builds run on the GitHub hosted runners and the aarch64 builds run on the Ubicloud runners
17+
- `ubicloud`: Both the x86_64 and the aarch64 builds run on the Ubicloud runners
18+
default: mixed
19+
type: string
1320
secrets:
1421
harbor-robot-secret:
1522
description: The secret for the Harbor robot user used to push images and manifest
@@ -19,8 +26,33 @@ on:
1926
required: true
2027

2128
jobs:
22-
generate_matrix:
23-
name: Generate Version List
29+
generate_runner_dimension:
30+
name: Generate Runner Dimension
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
with:
35+
persist-credentials: false
36+
- id: runners
37+
shell: bash
38+
env:
39+
RUNNERS_TYPE: ${{ inputs.runners }}
40+
run: |
41+
if [ "$RUNNERS_TYPE" == "mixed" ]; then
42+
RUNNERS=$(jq --compact-output < .github/workflows/runners/mixed.json)
43+
echo "RUNNERS=$RUNNERS" | tee -a "$GITHUB_OUTPUT"
44+
elif [ "$RUNNERS_TYPE" == "ubicloud" ]; then
45+
RUNNERS=$(jq --compact-output < .github/workflows/runners/ubicloud.json)
46+
echo "RUNNERS=$RUNNERS" | tee -a "$GITHUB_OUTPUT"
47+
else
48+
echo "Invalid runners type, expected 'mixed' or 'ubicloud'"
49+
exit 1
50+
fi
51+
outputs:
52+
runners: ${{ steps.runners.outputs.RUNNERS }}
53+
54+
generate_version_dimension:
55+
name: Generate Version Dimension
2456
runs-on: ubuntu-latest
2557
steps:
2658
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -35,17 +67,17 @@ jobs:
3567

3668
build:
3769
name: Build/Publish ${{ matrix.versions }}-${{ matrix.runner.arch }} Image
38-
needs: [generate_matrix]
70+
needs:
71+
- generate_version_dimension
72+
- generate_runner_dimension
3973
permissions:
4074
id-token: write
4175
runs-on: ${{ matrix.runner.name }}
4276
strategy:
4377
fail-fast: false
4478
matrix:
45-
runner:
46-
- {name: "ubuntu-latest", arch: "amd64"}
47-
- {name: "ubicloud-standard-8-arm-ubuntu-2404", arch: "arm64"}
48-
versions: ${{ fromJson(needs.generate_matrix.outputs.versions) }}
79+
versions: ${{ fromJson(needs.generate_version_dimension.outputs.versions) }}
80+
runner: ${{ fromJson(needs.generate_runner_dimension.outputs.runners) }}
4981
steps:
5082
- name: Checkout Repository
5183
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -76,14 +108,14 @@ jobs:
76108

77109
publish_manifests:
78110
name: Build/Publish ${{ matrix.versions }} Manifests
79-
needs: [generate_matrix, build]
111+
needs: [generate_version_dimension, build]
80112
permissions:
81113
id-token: write
82114
runs-on: ubuntu-latest
83115
strategy:
84116
fail-fast: false
85117
matrix:
86-
versions: ${{ fromJson(needs.generate_matrix.outputs.versions) }}
118+
versions: ${{ fromJson(needs.generate_version_dimension.outputs.versions) }}
87119
steps:
88120
- name: Checkout Repository
89121
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -101,7 +133,7 @@ jobs:
101133

102134
notify:
103135
name: Failure Notification
104-
needs: [generate_matrix, build, publish_manifests]
136+
needs: [generate_version_dimension, build, publish_manifests]
105137
runs-on: ubuntu-latest
106138
if: failure() || (github.run_attempt > 1 && !cancelled())
107139
steps:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"name": "ubuntu-latest",
4+
"arch": "amd64"
5+
},
6+
{
7+
"name": "ubicloud-standard-8-arm-ubuntu-2404",
8+
"arch": "arm64"
9+
}
10+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"name": "ubicloud-standard-8-ubuntu-2404",
4+
"arch": "amd64"
5+
},
6+
{
7+
"name": "ubicloud-standard-8-arm-ubuntu-2404",
8+
"arch": "arm64"
9+
}
10+
]

0 commit comments

Comments
 (0)