Skip to content

Commit 0af0efd

Browse files
authored
CLOUDP-295785 - Fix multi-arch builds by migrating away from goreleaser (#547)
# Summary ⚠️ Some of the files were moved and this messes up GitHub preview. It's better to review the last commit with all the changes ec01373 Completely removed `goreleaser` usage in the project. It was preventing us to build multiarch `kubect-mongodb` plugin binaries. There were also other reasons to drop `goreleaser` i.e. it was only used to build binaries, nothing else was used, but required us to keep additional, static `.goreleaser.yaml` that was not compatible with `build_info.json`. This PR also improves quite a lot of other things: - moves building of `kubectl-mongodb` plugin to a separate evergreen task - `kubectl-mongodb` plugin is now only dowloaded when building test image. This means we need to wait with building test image for `kubectl-plugin` to be available in s3 - `promote_kubectl_plugin.py` now uses temp_dir instead of hardcoded `./artifacts` dir. Previously we couldn't re-run the promotion pipeline if the signatures were already present on the machine: `Signature already exists. Displaying proof` - simplified and unified the [build_kubectl_plugin.py‎](https://github.com/mongodb/mongodb-kubernetes/pull/547/files#diff-a6df2ec746c87a5d07b813bb16612734474e6c40f6f60a38f194802403dd4fe7) and [download_kubectl_plugin.py](https://github.com/mongodb/mongodb-kubernetes/pull/547/files#diff-eac03d2b21304201e625cb87a6701449d4ba1cfa0c3dbaa129db2dbd6522f2d4) scripts - removed all references to `goreleaser` - `kubectl-mongodb` also pushes binaries to s3 release bucket so they can be used for e2e smoke tests - `kubectl-mongodb` is now pushed to staging and released with two new architectures: - `linux/s390x` - `linux/ppc64le` ## Proof of Work Passing CI for PR. Passing CI for [smoke arm on staging scenario](https://spruce.mongodb.com/version/68fb37de9e149f0007e8638a) (with arm smoke tests enabled) Passing CI for [release scenario](https://spruce.mongodb.com/version/68fa1b1b9b6f3600075262c0/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC) (`release_kubectl_mongodb_plugin` fails on adding assets to GH release, which is expected since there is no release `rc-1.3.0`) ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [x] Have you added changelog file? - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details
1 parent 582d248 commit 0af0efd

32 files changed

+702
-864
lines changed

.evergreen-functions.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,13 @@ functions:
515515
- command: subprocess.exec
516516
params:
517517
working_dir: src/github.com/mongodb/mongodb-kubernetes
518-
binary: scripts/dev/run_python.sh scripts/release/kubectl_mongodb/python/build_kubectl_plugin.py
519-
520-
build_and_push_appdb_database:
518+
binary: scripts/release/kubectl_mongodb/build_kubectl_plugin.sh
519+
520+
download_multi_cluster_binary:
521521
- command: subprocess.exec
522522
params:
523-
working_dir: src/github.com/mongodb/mongodb-kubernetes/docker/mongodb-kubernetes-appdb-database
524-
binary: ./build_and_push_appdb_database_images.sh
525-
add_to_path:
526-
- ${workdir}/bin
527-
- ${workdir}
523+
working_dir: src/github.com/mongodb/mongodb-kubernetes
524+
binary: scripts/release/kubectl_mongodb/download_kubectl_plugin.sh
528525

529526
build_test_image_ibm:
530527
- command: subprocess.exec
@@ -801,22 +798,6 @@ functions:
801798
script: |
802799
./scripts/code_snippets/tests/${task_name}
803800
804-
#
805-
# kubectl mongodb plugin release functions
806-
#
807-
install_goreleaser:
808-
- command: shell.exec
809-
type: setup
810-
include_expansions_in_env:
811-
- goreleaser_pro_tar_gz
812-
params:
813-
script: |
814-
set -Eeu pipefail
815-
curl -fL "${goreleaser_pro_tar_gz}" --output goreleaser_Linux_x86_64.tar.gz
816-
tar -xf goreleaser_Linux_x86_64.tar.gz
817-
chmod 755 ./goreleaser
818-
sudo cp goreleaser /usr/local/bin/
819-
820801
install_macos_notarization_service:
821802
- command: shell.exec
822803
type: setup
@@ -851,7 +832,7 @@ functions:
851832
- command: github.generate_token
852833
params:
853834
expansion_name: GH_TOKEN
854-
- command: shell.exec
835+
- command: subprocess.exec
855836
type: setup
856837
params:
857838
working_dir: src/github.com/mongodb/mongodb-kubernetes
@@ -868,10 +849,7 @@ functions:
868849
- triggered_by_git_tag
869850
- OPERATOR_VERSION
870851
env:
871-
XDG_CONFIG_HOME: ${go_base_path}${workdir}
872-
GO111MODULE: "on"
873-
GOROOT: "/opt/golang/go1.24"
874852
MACOS_NOTARY_KEY: ${macos_notary_keyid}
875853
MACOS_NOTARY_SECRET: ${macos_notary_secret}
876854
GH_TOKEN: ${GH_TOKEN}
877-
script: scripts/dev/run_python.sh scripts/release/kubectl_mongodb/python/promote_kubectl_plugin.py
855+
binary: scripts/dev/run_python.sh scripts/release/kubectl_mongodb/promote_kubectl_plugin.py

.evergreen-release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tasks:
99
commands:
1010
- func: clone
1111
- func: setup_building_host
12-
- func: build_multi_cluster_binary
12+
- func: download_multi_cluster_binary
1313
- func: pipeline
1414
vars:
1515
image_name: meko-tests
@@ -123,9 +123,8 @@ tasks:
123123
tags: [ "binary_release" ]
124124
commands:
125125
- func: clone
126-
- func: install_goreleaser
127-
- func: install_macos_notarization_service
128126
- func: python_venv
127+
- func: install_macos_notarization_service
129128
- func: release_kubectl_mongodb_plugin
130129

131130
- name: create_chart_release_pr
@@ -134,7 +133,7 @@ tasks:
134133
- func: clone
135134
- func: python_venv
136135
- func: create_chart_release_pr
137-
136+
138137
- name: release_chart_to_oci_registry
139138
tags: [ "release_chart_to_oci_registry" ]
140139
commands:
@@ -224,6 +223,9 @@ buildvariants:
224223
allowed_requesters: [ "patch", "github_tag" ]
225224
run_on:
226225
- release-ubuntu2404-small # This is required for CISA attestation https://jira.mongodb.org/browse/DEVPROD-17780
226+
depends_on:
227+
- name: release_kubectl_mongodb_plugin
228+
variant: release_kubectl_mongodb_plugin
227229
tasks:
228230
- name: build_test_image_for_smoke_tests
229231

@@ -250,6 +252,8 @@ buildvariants:
250252
depends_on:
251253
- name: "*"
252254
variant: release_images
255+
- name: "*"
256+
variant: init_smoke_tests
253257
tasks:
254258
- name: e2e_smoke_task_group
255259

.evergreen-snippets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ variables:
77
- func: setup_mongosh
88
- func: download_kube_tools
99
- func: switch_context
10-
- func: build_multi_cluster_binary
10+
- func: download_multi_cluster_binary
1111
teardown_task:
1212
- func: upload_e2e_logs
1313
- func: upload_code_snippets_logs

.evergreen.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ variables:
8282
- func: clone
8383
- func: switch_context
8484
- func: setup_building_host_minikube
85-
- func: install_goreleaser
86-
- func: build_multi_cluster_binary
8785

8886
- &setup_group_multi_cluster
8987
setup_group_can_fail_task: true
@@ -92,8 +90,6 @@ variables:
9290
- func: download_kube_tools
9391
- func: switch_context
9492
- func: setup_building_host
95-
- func: install_goreleaser
96-
- func: build_multi_cluster_binary
9793

9894
- &setup_and_teardown_task_cloudqa
9995
setup_task_can_fail_task: true
@@ -348,12 +344,17 @@ tasks:
348344
image_name: agent
349345
flags: "--parallel --current-agents --skip-if-exists=false"
350346

351-
- name: build_test_image
347+
- name: build_kubectl_mongodb_plugin
352348
commands:
353349
- func: clone
354350
- func: setup_building_host
355-
- func: install_goreleaser
356351
- func: build_multi_cluster_binary
352+
353+
- name: build_test_image
354+
commands:
355+
- func: clone
356+
- func: setup_building_host
357+
- func: download_multi_cluster_binary
357358
- func: pipeline
358359
vars:
359360
image_name: meko-tests
@@ -362,8 +363,7 @@ tasks:
362363
commands:
363364
- func: clone
364365
- func: setup_building_host
365-
- func: install_goreleaser
366-
- func: build_multi_cluster_binary
366+
- func: download_multi_cluster_binary
367367
- func: pipeline
368368
vars:
369369
image_name: meko-tests-arm64
@@ -380,8 +380,7 @@ tasks:
380380
add_to_path:
381381
- ${workdir}/bin
382382
command: scripts/evergreen/setup_minikube_host.sh
383-
- func: install_goreleaser
384-
- func: build_multi_cluster_binary
383+
- func: download_multi_cluster_binary
385384
- func: build_test_image_ibm
386385

387386
- name: build_mco_test_image
@@ -1506,9 +1505,6 @@ buildvariants:
15061505
variant: init_test_run
15071506
- name: build_test_image_arm
15081507
variant: init_test_run_arm
1509-
# TODO: Re-enable when staging is added to pipeline
1510-
# https://jira.mongodb.org/browse/CLOUDP-349096
1511-
disable: true
15121508
tasks:
15131509
- name: e2e_smoke_arm_task_group
15141510

@@ -1525,9 +1521,6 @@ buildvariants:
15251521
variant: init_test_run
15261522
- name: build_test_image_arm
15271523
variant: init_test_run_arm
1528-
# TODO: Re-enable when staging is added to pipeline
1529-
# https://jira.mongodb.org/browse/CLOUDP-349096
1530-
disable: true
15311524
tasks:
15321525
- name: e2e_smoke_arm_task_group
15331526

@@ -1723,6 +1716,8 @@ buildvariants:
17231716
- name: build_operator_ubi
17241717
- name: build_operator_race_ubi
17251718
- name: build_test_image
1719+
depends_on:
1720+
- name: build_kubectl_mongodb_plugin
17261721
- name: build_mco_test_image
17271722
- name: build_init_appdb_images_ubi
17281723
- name: build_init_om_images_ubi
@@ -1731,6 +1726,7 @@ buildvariants:
17311726
- name: build_agent_images_ubi
17321727
- name: build_readiness_probe_image
17331728
- name: build_version_upgrade_hook_image
1729+
- name: build_kubectl_mongodb_plugin
17341730
- name: prepare_aws
17351731
- name: publish_helm_chart
17361732

@@ -1744,6 +1740,9 @@ buildvariants:
17441740
run_on:
17451741
- rhel9-power-small
17461742
- rhel9-power-large
1743+
depends_on:
1744+
- name: build_kubectl_mongodb_plugin
1745+
variant: init_test_run
17471746
tasks:
17481747
- name: build_test_image_ibm
17491748

@@ -1757,6 +1756,9 @@ buildvariants:
17571756
run_on:
17581757
- rhel9-zseries-small
17591758
- rhel9-zseries-large
1759+
depends_on:
1760+
- name: build_kubectl_mongodb_plugin
1761+
variant: init_test_run
17601762
tasks:
17611763
- name: build_test_image_ibm
17621764

@@ -1766,6 +1768,9 @@ buildvariants:
17661768
tags: [ "staging" ]
17671769
run_on:
17681770
- ubuntu2204-arm64-small
1771+
depends_on:
1772+
- name: build_kubectl_mongodb_plugin
1773+
variant: init_test_run
17691774
tasks:
17701775
- name: build_test_image_arm
17711776

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ logs-debug/
8989
docs/**/log/*
9090
docs/**/test.sh.run.log
9191

92-
# goreleaser generated files
93-
dist
9492
logs
9593
*.run.log
9694

.goreleaser.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ build-and-push-operator-image: aws_login
159159
build-and-push-database-image: aws_login
160160
@ scripts/dev/build_push_database_image
161161

162-
build-and-push-test-image: aws_login build-multi-cluster-binary
162+
build-and-push-test-image: aws_login
163163
@ if [[ -z "$(local)" ]]; then \
164164
scripts/dev/run_python.sh scripts/release/pipeline.py test; \
165165
fi
@@ -169,9 +169,6 @@ build-and-push-mco-test-image: aws_login
169169
scripts/dev/run_python.sh scripts/release/pipeline.py mco-test; \
170170
fi
171171

172-
build-multi-cluster-binary:
173-
scripts/evergreen/build_multi_cluster_kubeconfig_creator.sh
174-
175172
# builds all app images in parallel
176173
# note that we cannot build both appdb and database init images in parallel as they change the same docker file
177174
build-and-push-images: build-and-push-operator-image appdb-init-image om-init-image database operator-image database-init-image

build_info.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,14 @@
356356
]
357357
},
358358
"staging": {
359-
"sign": false,
360359
"s3-store": "mongodb-kubernetes-staging",
361360
"platforms": [
362361
"darwin/amd64",
363362
"darwin/arm64",
364363
"linux/amd64",
365-
"linux/arm64"
364+
"linux/arm64",
365+
"linux/s390x",
366+
"linux/ppc64le"
366367
]
367368
},
368369
"release": {
@@ -372,7 +373,9 @@
372373
"darwin/amd64",
373374
"darwin/arm64",
374375
"linux/amd64",
375-
"linux/arm64"
376+
"linux/arm64",
377+
"linux/s390x",
378+
"linux/ppc64le"
376379
]
377380
}
378381
}

0 commit comments

Comments
 (0)