Skip to content

Commit e1803a6

Browse files
authored
Merge pull request #319 from elastic/backport/8.10/pr-318
2 parents ae5b845 + a5a03b8 commit e1803a6

File tree

10 files changed

+222
-4
lines changed

10 files changed

+222
-4
lines changed

.buildkite/branches.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# This determines which branches will have pipelines triggered periodically, for dra workflows.
4+
BRANCHES=(main 8.10 8.9 7.17)

.buildkite/dra-build.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
New-Item C:/.cert -Type Directory -Force
2+
[IO.File]::WriteAllText("C:/.cert/msi_certificate.p12", $Env:MSI_CERTIFICATE_SECRET)
3+
[IO.File]::WriteAllText("C:/.cert/msi_password.txt", $Env:MSI_PASSWORD)
4+
5+
Select-String -Pattern '^set\(DRV_VERSION (.*)\)$' -Path ".\CMakeLists.txt" | Select-Object -ExpandProperty Matches -First 1 -OutVariable Match
6+
$VersionString=$Match.groups[1].Value
7+
8+
if ($Env:DRA_WORKFLOW -eq "staging") {
9+
cmd.exe /c 'build.bat setup proper'
10+
cmd.exe /c 'build.bat setup 64 type:Release package sign:C:/.cert/msi_certificate.p12+C:/.cert/msi_password.txt'
11+
cmd.exe /c 'build.bat setup 32 type:Release package sign:C:/.cert/msi_certificate.p12+C:/.cert/msi_password.txt'
12+
} else {
13+
cmd.exe /c 'build.bat setup proper'
14+
cmd.exe /c 'build.bat setup 64 type:Release package:-SNAPSHOT sign:C:/.cert/msi_certificate.p12+C:/.cert/msi_password.txt'
15+
cmd.exe /c 'build.bat setup 32 type:Release package:-SNAPSHOT sign:C:/.cert/msi_certificate.p12+C:/.cert/msi_password.txt'
16+
}
17+
18+
buildkite-agent artifact upload 'installer/build/out/*.msi'

.buildkite/dra-release.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
DRA_WORKFLOW=${DRA_WORKFLOW:-snapshot}
6+
7+
if [[ "$BUILDKITE_BRANCH" == "main" && "$DRA_WORKFLOW" == "staging" ]]; then
8+
exit 0
9+
fi
10+
11+
buildkite-agent artifact download '*.msi' .
12+
13+
RM_BRANCH="$BUILDKITE_BRANCH"
14+
if [[ "$BUILDKITE_BRANCH" == "main" ]]; then
15+
RM_BRANCH=master
16+
fi
17+
18+
DRV_VERSION=$(grep 'set(DRV_VERSION' CMakeLists.txt | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
19+
GIT_COMMIT=$(git rev-parse HEAD)
20+
21+
# Allow other users access to read the artifacts so they are readable in the container
22+
chmod a+r installer/build/out/*
23+
24+
# Allow other users write access to create checksum files
25+
chmod a+w installer/build/out
26+
27+
docker run --rm \
28+
--name release-manager \
29+
-e VAULT_ADDR="$DRA_VAULT_ADDR" \
30+
-e VAULT_ROLE_ID="$DRA_VAULT_ROLE_ID_SECRET" \
31+
-e VAULT_SECRET_ID="$DRA_VAULT_SECRET_ID_SECRET" \
32+
--mount type=bind,readonly=false,src="$PWD",target=/artifacts \
33+
docker.elastic.co/infra/release-manager:latest \
34+
cli collect \
35+
--project elasticsearch-sql-odbc \
36+
--branch "$RM_BRANCH" \
37+
--commit "$GIT_COMMIT" \
38+
--workflow "$DRA_WORKFLOW" \
39+
--version "$DRV_VERSION" \
40+
--artifact-set main

.buildkite/dra-workflow.trigger.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
echo "steps:"
6+
7+
source .buildkite/branches.sh
8+
9+
for BRANCH in "${BRANCHES[@]}"; do
10+
cat <<EOF
11+
- trigger: elasticsearch-sql-odbc-dra-workflow
12+
label: Trigger DRA snapshot workflow for $BRANCH
13+
async: true
14+
build:
15+
branch: $BRANCH
16+
env:
17+
DRA_WORKFLOW: snapshot
18+
EOF
19+
20+
# Don't trigger staging workflow for main branch
21+
if [[ "$BRANCH" != "main" ]]; then
22+
cat <<EOF
23+
- trigger: elasticsearch-sql-odbc-dra-workflow
24+
label: Trigger DRA staging workflow for $BRANCH
25+
async: true
26+
build:
27+
branch: $BRANCH
28+
env:
29+
DRA_WORKFLOW: staging
30+
EOF
31+
fi
32+
done

.buildkite/hooks/pre-command

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
if [[ "$USE_DRA_CREDENTIALS" == "true" ]]; then
4+
DRA_VAULT_ROLE_ID_SECRET=$(vault read -field=role-id secret/ci/elastic-elasticsearch-sql-odbc/legacy-vault-credentials)
5+
export DRA_VAULT_ROLE_ID_SECRET
6+
7+
DRA_VAULT_SECRET_ID_SECRET=$(vault read -field=secret-id secret/ci/elastic-elasticsearch-sql-odbc/legacy-vault-credentials)
8+
export DRA_VAULT_SECRET_ID_SECRET
9+
10+
DRA_VAULT_ADDR=https://secrets.elastic.co:8200
11+
export DRA_VAULT_ADDR
12+
fi

.buildkite/hooks/pre-command.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$env:MSI_CERTIFICATE_SECRET = vault read -field=cert secret/ci/elastic-elasticsearch-sql-odbc/msi
2+
$env:MSI_PASSWORD = vault read -field=password secret/ci/elastic-elasticsearch-sql-odbc/msi

.buildkite/pipeline.dra.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
steps:
2+
- label: Build artifacts
3+
command: powershell .buildkite\dra-build.ps1
4+
agents:
5+
provider: gcp
6+
image: family/elasticsearch-windows-2022
7+
machineType: n2-standard-8
8+
diskSizeGb: 200
9+
- wait
10+
- label: Publish artifacts
11+
command: .buildkite/dra-release.sh
12+
env:
13+
USE_DRA_CREDENTIALS: "true"
14+
agents:
15+
provider: gcp
16+
image: family/elasticsearch-ubuntu-2004
17+
machineType: n2-standard-4
18+
diskSizeGb: 100

.buildkite/pipeline.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
steps:
2+
- label: Run tests
3+
command: cmd /c build.bat ctests
4+
agents:
5+
provider: gcp
6+
image: family/elasticsearch-windows-2022
7+
machineType: n2-standard-8
8+
diskSizeGb: 200

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ indent_size = 4
1616
indent_style = space
1717
indent_size = 4
1818

19-
[*.{md,markdown,json,js,csproj,fsproj,targets,targets,props}]
19+
[*.{md,markdown,json,js,csproj,fsproj,targets,targets,props,yml,yaml}]
2020
indent_style = space
2121
indent_size = 2
2222

catalog-info.yaml

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ apiVersion: backstage.io/v1alpha1
44
kind: Resource
55
metadata:
66
name: buildkite-pipeline-elasticsearch-sql-odbc
7-
description: Buildkite Pipeline for elasticsearch-sql-odbc
7+
description: On-merge pipeline for elasticsearch-sql-odbc tests
88
links:
99
- title: Pipeline
1010
url: https://buildkite.com/elastic/elasticsearch-sql-odbc
11-
1211
spec:
1312
type: buildkite-pipeline
1413
owner: group:elasticsearch-team
@@ -20,9 +19,94 @@ spec:
2019
name: elasticsearch-sql-odbc
2120
spec:
2221
repository: elastic/elasticsearch-sql-odbc
23-
pipeline_file: ".buildkite/pipeline.yml"
22+
pipeline_file: .buildkite/pipeline.yml
23+
default_branch: main
24+
branch_configuration: "main 8.* 7.17"
25+
provider_settings:
26+
trigger_mode: code
27+
build_pull_requests: false
28+
build_pull_request_forks: false
29+
publish_commit_status: false
30+
build_branches: true
2431
teams:
2532
elasticsearch-team:
2633
access_level: MANAGE_BUILD_AND_READ
2734
everyone:
2835
access_level: BUILD_AND_READ
36+
---
37+
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
38+
apiVersion: backstage.io/v1alpha1
39+
kind: Resource
40+
metadata:
41+
name: buildkite-pipeline-elasticsearch-sql-odbc-dra-workflow
42+
description: Publishes DRA snapshot or staging candidate
43+
links:
44+
- title: Pipeline
45+
url: https://buildkite.com/elastic/elasticsearch-sql-odbc-dra-workflow
46+
spec:
47+
type: buildkite-pipeline
48+
system: buildkite
49+
owner: group:elasticsearch-team
50+
implementation:
51+
apiVersion: buildkite.elastic.dev/v1
52+
kind: Pipeline
53+
metadata:
54+
description: "Publishes DRA snapshot or staging candidate"
55+
name: elasticsearch-sql-odbc / dra-workflow
56+
spec:
57+
repository: elastic/elasticsearch-sql-odbc
58+
pipeline_file: .buildkite/pipeline.dra.yml
59+
env:
60+
ENABLE_DRA_WORKFLOW: "true"
61+
default_branch: main
62+
branch_configuration: "main 8.* 7.17"
63+
teams:
64+
elasticsearch-team: {}
65+
everyone:
66+
access_level: BUILD_AND_READ
67+
provider_settings:
68+
trigger_mode: none
69+
build_pull_requests: false
70+
build_pull_request_forks: false
71+
publish_commit_status: false
72+
build_branches: false
73+
---
74+
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
75+
apiVersion: backstage.io/v1alpha1
76+
kind: Resource
77+
metadata:
78+
name: buildkite-pipeline-elasticsearch-sql-odbc-dra-workflow-trigger
79+
description: Triggers piplines for DRA workflows for all release branches
80+
links:
81+
- title: Pipeline
82+
url: https://buildkite.com/elastic/elasticsearch-sql-odbc-dra-workflow-trigger
83+
spec:
84+
type: buildkite-pipeline
85+
system: buildkite
86+
owner: group:elasticsearch-team
87+
implementation:
88+
apiVersion: buildkite.elastic.dev/v1
89+
kind: Pipeline
90+
metadata:
91+
description: Triggers piplines for DRA workflows for all release branches
92+
name: elasticsearch-sql-odbc / dra-workflow-trigger
93+
spec:
94+
repository: elastic/elasticsearch-sql-odbc
95+
pipeline_file: .buildkite/dra-workflow.trigger.sh
96+
default_branch: main
97+
branch_configuration: main
98+
teams:
99+
elasticsearch-team: {}
100+
everyone:
101+
access_level: BUILD_AND_READ
102+
provider_settings:
103+
trigger_mode: none
104+
build_pull_requests: false
105+
build_pull_request_forks: false
106+
publish_commit_status: false
107+
build_branches: false
108+
schedules:
109+
Periodically on main:
110+
branch: main
111+
cronline: "0 0,12 * * * America/New_York"
112+
message: "Triggers DRA workflows 2x per day"

0 commit comments

Comments
 (0)