Skip to content

Commit 6f986ef

Browse files
authored
add script to backup csv (#240)
# Summary This pull request introduces a new script and corresponding Evergreen tasks to backup digest-pinned images from a ClusterServiceVersion (CSV) YAML file to Quay.io. The changes include adding a Python script to perform the backup process, new Evergreen tasks to execute the script, and a new build variant for these tasks. ### New Evergreen tasks and build variant: * [`.evergreen.yml`](diffhunk://#diff-9a7744843f307953832ec106e8d49be546037475db24ec6873e5fec6249c236dR608-R647): Added three new tasks (`backup_csv_images_dry_run`, `backup_csv_images_limit_3`, and `backup_csv_images_all`) to run the backup script with different options, and created a new build variant (`backup_csv_images`) to group these tasks under the "Backup CSV Images" workflow. [[1]](diffhunk://#diff-9a7744843f307953832ec106e8d49be546037475db24ec6873e5fec6249c236dR608-R647) [[2]](diffhunk://#diff-9a7744843f307953832ec106e8d49be546037475db24ec6873e5fec6249c236dR1245-R1255) ### New Python script for image backup: * [`scripts/dev/release/backup_csv_images.py`](diffhunk://#diff-cd0fc9d64b8e8c03c901ad1ebcba9734985ab170613937b2b0e7dcb91b94037cR1-R370): Added a comprehensive Python script to parse a CSV file, extract digest-pinned images, and back them up to Quay.io using a new tag format (`_openshift_<mck_version>`). The script supports dry-run mode, logging, and limiting the number of images to back up. ## Proof of Work https://parsley.mongodb.com/evergreen/mongodb_kubernetes_backup_csv_images_backup_csv_images_all_patch_5710105f0347aed651ce63e6b37f06051caa634a_686e4ee749d2610007d96aaa_25_07_09_11_13_48/0/task?bookmarks=0,11182&shareLine=3143 ![Screenshot 2025-07-09 at 14 10 21](https://github.com/user-attachments/assets/82717ced-b4df-4b64-867d-d789cc662de8) ![Screenshot 2025-07-09 at 14 10 33](https://github.com/user-attachments/assets/7e34a30d-3439-4792-b1af-cfd9e713a2be) ## 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 checked for release_note changes? ## Reminder (Please remove this when merging) - Please try to Approve or Reject Changes the PR, keep PRs in review as short as possible - Our Short Guide for PRs: [Link](https://docs.google.com/document/d/1T93KUtdvONq43vfTfUt8l92uo4e4SEEvFbIEKOxGr44/edit?tab=t.0) - Remember the following Communication Standards - use comment prefixes for clarity: * **blocking**: Must be addressed before approval. * **follow-up**: Can be addressed in a later PR or ticket. * **q**: Clarifying question. * **nit**: Non-blocking suggestions. * **note**: Side-note, non-actionable. Example: Praise * --> no prefix is considered a question
1 parent 2571d04 commit 6f986ef

File tree

4 files changed

+2403
-0
lines changed

4 files changed

+2403
-0
lines changed

.evergreen.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,46 @@ tasks:
610610
variant: prepare_openshift_bundles
611611
task: prepare_and_upload_openshift_bundles
612612

613+
- name: backup_csv_images_dry_run
614+
commands:
615+
- func: clone
616+
- func: quay_login
617+
- command: subprocess.exec
618+
params:
619+
working_dir: src/github.com/mongodb/mongodb-kubernetes
620+
binary: python3
621+
args:
622+
- scripts/dev/release/backup_csv_images.py
623+
- scripts/dev/release/1.2.0.clusterserviceversion.yaml
624+
- --dry-run
625+
- --verbose
626+
- name: backup_csv_images_limit_3
627+
commands:
628+
- func: clone
629+
- func: quay_login
630+
- command: subprocess.exec
631+
params:
632+
working_dir: src/github.com/mongodb/mongodb-kubernetes
633+
binary: python3
634+
args:
635+
- scripts/dev/release/backup_csv_images.py
636+
- scripts/dev/release/1.2.0.clusterserviceversion.yaml
637+
- --limit
638+
- "3"
639+
- --verbose
640+
- name: backup_csv_images_all
641+
commands:
642+
- func: clone
643+
- func: quay_login
644+
- command: subprocess.exec
645+
params:
646+
working_dir: src/github.com/mongodb/mongodb-kubernetes
647+
binary: python3
648+
args:
649+
- scripts/dev/release/backup_csv_images.py
650+
- scripts/dev/release/1.2.0.clusterserviceversion.yaml
651+
- --verbose
652+
613653
task_groups:
614654
- name: unit_task_group
615655
max_hosts: -1
@@ -1207,6 +1247,17 @@ task_groups:
12071247

12081248
buildvariants:
12091249

1250+
## Backup CSV Images Variant
1251+
- name: backup_csv_images
1252+
display_name: "Backup CSV Images"
1253+
tags: [ "release_csv_backup" ]
1254+
run_on:
1255+
- ubuntu2204-small
1256+
tasks:
1257+
- name: backup_csv_images_dry_run
1258+
- name: backup_csv_images_limit_3
1259+
- name: backup_csv_images_all
1260+
12101261
## Unit tests + lint build variant
12111262

12121263
- name: unit_tests

0 commit comments

Comments
 (0)