Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-211733 - Pipeline and build process refactoring #1427

Merged
merged 32 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b0c2400
Refactor pipeline
Julien-Ben Nov 22, 2023
cba917b
Update calls to pipeline
Julien-Ben Nov 16, 2023
e2bdd77
Update operator inventory
Julien-Ben Nov 16, 2023
ca9e949
Cleanup DevConfig class
Julien-Ben Nov 16, 2023
cbe68be
type hinting
Julien-Ben Nov 16, 2023
fbfc638
Fix agent key
Julien-Ben Nov 16, 2023
300b9a3
Dev config method renaming
Julien-Ben Nov 16, 2023
53395d4
Handle architectures and tags correctly
Julien-Ben Nov 16, 2023
f8672a4
Pre-commit formatting
Julien-Ben Nov 16, 2023
4c798c3
black formatting
Julien-Ben Nov 16, 2023
59ced60
Correct usage of --release flag
Julien-Ben Nov 16, 2023
a874160
Refactor arg parsing and handle gh_run_id
Julien-Ben Nov 16, 2023
7c7e755
Correct agent arg usage
Julien-Ben Nov 16, 2023
c258e06
Fix e2e building
Julien-Ben Nov 16, 2023
c36438d
Check that image_dev exists
Julien-Ben Nov 16, 2023
2107aaa
Handle skip tag
Julien-Ben Nov 16, 2023
6d636f0
Fix push manifest logic for e2e
Julien-Ben Nov 16, 2023
2e41289
Better handling of manifest creation
Julien-Ben Nov 16, 2023
b12c9e4
Black formatting
Julien-Ben Nov 16, 2023
46a0fed
Remove old agent in Contributing and Makefile
Julien-Ben Nov 16, 2023
21db206
Update pipeline.py
Julien-Ben Nov 16, 2023
0218068
Improve function for CLI command
Julien-Ben Nov 20, 2023
4478bd6
Fix usage of inventory tags
Julien-Ben Nov 20, 2023
9be2175
Updated Helm Charts
Julien-Ben Nov 22, 2023
1f78622
Revert helm changes
Julien-Ben Nov 27, 2023
1a2ca3e
temporary disable workflow condition
Julien-Ben Nov 28, 2023
bff4ebe
Use the right release keys
Julien-Ben Nov 28, 2023
bf8287c
Temporary disable if
Julien-Ben Nov 28, 2023
f76ed1e
Revert "Temporary disable if"
Julien-Ben Nov 28, 2023
1716aab
Revert "temporary disable workflow condition"
Julien-Ben Nov 28, 2023
2fe2492
Warning user if releasing e2e
Julien-Ben Nov 28, 2023
12f16f1
black formatting
Julien-Ben Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .action_templates/jobs/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ setup:
fail-fast: false
matrix:
include:
- pipeline-argument: operator-ubi
Julien-Ben marked this conversation as resolved.
Show resolved Hide resolved
- pipeline-argument: version-post-start-hook-init
- pipeline-argument: readiness-probe-init
- pipeline-argument: agent-ubi
- pipeline-argument: mongodb-kubernetes-operator
- pipeline-argument: version-upgrade-hook
- pipeline-argument: readiness-probe
- pipeline-argument: agent
- pipeline-argument: e2e
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: Build and Push Images
run: |
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }}
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --tag ${{ github.run_id }}
env:
MONGODB_COMMUNITY_CONFIG: "${{ github.workspace }}/scripts/ci/config.json"
version_id: "${{ github.run_id }}"
10 changes: 5 additions & 5 deletions .github/workflows/e2e-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
fail-fast: false
matrix:
include:
- pipeline-argument: operator-ubi
- pipeline-argument: version-post-start-hook-init
- pipeline-argument: readiness-probe-init
- pipeline-argument: agent-ubi
- pipeline-argument: operator
- pipeline-argument: version-upgrade-hook
- pipeline-argument: readiness-probe
- pipeline-argument: agent
- pipeline-argument: e2e
steps:
# template: .action_templates/steps/checkout.yaml
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
# template: .action_templates/steps/build-and-push-development-images.yaml
- name: Build and Push Images
run: |
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }}
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --tag ${{ github.run_id }}
env:
MONGODB_COMMUNITY_CONFIG: ${{ github.workspace }}/scripts/ci/config.json
version_id: ${{ github.run_id }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
fail-fast: false
matrix:
include:
- pipeline-argument: operator-ubi
- pipeline-argument: version-post-start-hook-init
- pipeline-argument: readiness-probe-init
- pipeline-argument: agent-ubi
- pipeline-argument: operator
- pipeline-argument: version-upgrade-hook
- pipeline-argument: readiness-probe
- pipeline-argument: agent
- pipeline-argument: e2e
if: contains(github.event.pull_request.labels.*.name, 'dependencies') || contains(github.event.pull_request.labels.*.name,
'safe-to-test')
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
# template: .action_templates/steps/build-and-push-development-images.yaml
- name: Build and Push Images
run: |
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }}
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --tag ${{ github.run_id }}
env:
MONGODB_COMMUNITY_CONFIG: ${{ github.workspace }}/scripts/ci/config.json
version_id: ${{ github.run_id }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
fail-fast: false
matrix:
include:
- pipeline-argument: operator-ubi
- pipeline-argument: version-post-start-hook-init
- pipeline-argument: readiness-probe-init
- pipeline-argument: agent-ubi
- pipeline-argument: operator
- pipeline-argument: version-upgrade-hook
- pipeline-argument: readiness-probe
- pipeline-argument: agent
- pipeline-argument: e2e
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master'
|| (github.event.pull_request.head.repo.full_name == github.repository && github.actor
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
# template: .action_templates/steps/build-and-push-development-images.yaml
- name: Build and Push Images
run: |
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release false --tag ${{ github.run_id }}
python pipeline.py --image-name ${{ matrix.pipeline-argument }} --tag ${{ github.run_id }}
env:
MONGODB_COMMUNITY_CONFIG: ${{ github.workspace }}/scripts/ci/config.json
version_id: ${{ github.run_id }}
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/release-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ jobs:
strategy:
matrix:
include:
- pipeline-argument: operator-ubi
release-key: mongodb-kubernetes-operator
- pipeline-argument: version-post-start-hook-init
- pipeline-argument: operator
release-key: operator
- pipeline-argument: version-upgrade-hook
release-key: version-upgrade-hook
- pipeline-argument: readiness-probe-init
- pipeline-argument: readiness-probe
release-key: readiness-probe
- pipeline-argument: agent-ubi
release-key: mongodb-agent
- pipeline-argument: agent-ubuntu
release-key: mongodb-agent
- pipeline-argument: agent
release-key: agent

steps:
- name: Checkout Code
uses: actions/checkout@v2
Expand Down Expand Up @@ -57,7 +56,7 @@ jobs:

- name: Publish Image To Quay
if: steps.release_status.outputs.OUTPUT == 'unreleased'
run: python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release true
run: python pipeline.py --image-name ${{ matrix.pipeline-argument }} --release
env:
MONGODB_COMMUNITY_CONFIG: "${{ github.workspace }}/scripts/ci/config.json"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-single-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Publish Image To Quay
if: steps.release_status.outputs.OUTPUT == 'unreleased'
run: python pipeline.py --image-name ${{ github.event.inputs.pipeline-argument }} --release true
run: python pipeline.py --image-name ${{ github.event.inputs.pipeline-argument }} --release
env:
MONGODB_COMMUNITY_CONFIG: "${{ github.workspace }}/scripts/ci/config.json"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,19 @@ generate-env-file: ## generates a local-test.env for local testing
##@ Image

operator-image: ## Build and push the operator image
python pipeline.py --image-name operator-ubi
python pipeline.py --image-name operator

e2e-image: ## Build and push e2e test image
python pipeline.py --image-name e2e

agent-image: ## Build and push agent image
python pipeline.py --image-name agent-ubuntu
python pipeline.py --image-name agent-ubi
python pipeline.py --image-name agent

readiness-probe-image: ## Build and push readiness probe image
python pipeline.py --image-name readiness-probe-init
python pipeline.py --image-name readiness-probe

version-upgrade-post-start-hook-image: ## Build and push version upgrade post start hook image
python pipeline.py --image-name version-post-start-hook-init
python pipeline.py --image-name version-upgrade-hook

all-images: operator-image e2e-image agent-image readiness-probe-image version-upgrade-post-start-hook-image ## create all required images

Expand Down
9 changes: 3 additions & 6 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ to be able to run properly. Create a json file with the following content:
"operator_image": "mongodb-kubernetes-operator",
"e2e_image": "community-operator-e2e",
"version_upgrade_hook_image": "community-operator-version-upgrade-post-start-hook",
"agent_image_ubuntu": "mongodb-agent-dev",
"agent_image_ubi": "mongodb-agent-ubi-dev",
"agent_image": "mongodb-agent-ubi-dev",
"readiness_probe_image": "mongodb-kubernetes-readiness",
"s3_bucket": ""
}
Expand All @@ -73,10 +72,8 @@ to be able to run properly. Create a json file with the following content:
3. `operator_image` will be used as the name of the operator deployment, and the name of the operator image when build.
4. `e2e_image` the name of e2e test image that will be built.
5. `version_upgrade_hook_image` the name of the version upgrade post start hook image.
6. `image_type` this can be either `ubi` or `ubuntu` and determines the distro of the images built. (currently only the agent image has multiple distros)
7. `agent_image_ubuntu` the name of the ubuntu agent image.
8. `agent_image_ubi` the name of the ubi agent image.
9. `s3_bucket` the S3 bucket that Dockerfiles will be pushed to as part of the release process. Note: this is only required when running the release tasks locally.
6. `agent_image` the name of the agent image.
7. `s3_bucket` the S3 bucket that Dockerfiles will be pushed to as part of the release process. Note: this is only required when running the release tasks locally.


You can set the `MONGODB_COMMUNITY_CONFIG` environment variable to be the absolute path of this file.
Expand Down
12 changes: 6 additions & 6 deletions inventories/e2e-inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ images:
context: .
template_context: scripts/dev/templates
inputs:
- e2e_image
- image
platform: linux/arm64
stages:
- name: e2e-template
Expand All @@ -30,17 +30,17 @@ images:
quay.expires-after: 48h

output:
- registry: $(inputs.params.registry)/$(inputs.params.e2e_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: $(inputs.params.version_id)-arm64
- registry: $(inputs.params.registry)/$(inputs.params.e2e_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: latest-arm64

- name: e2e-amd64
vars:
context: .
template_context: scripts/dev/templates
inputs:
- e2e_image
- image
platform: linux/amd64
stages:
- name: e2e-template
Expand All @@ -63,8 +63,8 @@ images:
quay.expires-after: 48h

output:
- registry: $(inputs.params.registry)/$(inputs.params.e2e_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: $(inputs.params.version_id)-amd64
- registry: $(inputs.params.registry)/$(inputs.params.e2e_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: latest-amd64

40 changes: 20 additions & 20 deletions inventories/operator-inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ vars:
registry: <registry>

images:
- name: operator-ubi-amd64
- name: operator-amd64
vars:
context: .
template_context: scripts/dev/templates/operator

inputs:
- operator_image
- operator_image_dev
- image
- image_dev

platform: linux/amd64

Expand All @@ -29,7 +29,7 @@ images:
quay.expires-after: 48h

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev)
- registry: $(inputs.params.registry)/$(inputs.params.image_dev)
tag: $(inputs.params.version_id)-context-amd64

- name: operator-template-dev
Expand All @@ -51,15 +51,15 @@ images:
- version_id

buildargs:
imagebase: $(inputs.params.registry)/$(inputs.params.operator_image_dev):$(inputs.params.version_id)-context-amd64
imagebase: $(inputs.params.registry)/$(inputs.params.image_dev):$(inputs.params.version_id)-context-amd64

labels:
quay.expires-after: 48h

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev)
- registry: $(inputs.params.registry)/$(inputs.params.image_dev)
tag: $(inputs.params.version_id)-amd64
- registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev)
- registry: $(inputs.params.registry)/$(inputs.params.image_dev)
tag: latest-amd64

#
Expand All @@ -82,7 +82,7 @@ images:
builder_image: $(inputs.params.builder_image)

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: $(inputs.params.release_version)-context-amd64

- name: operator-template-release
Expand All @@ -107,23 +107,23 @@ images:
dockerfile: scripts/dev/templates/operator/Dockerfile.operator-$(inputs.params.release_version)

buildargs:
imagebase: $(inputs.params.registry)/$(inputs.params.operator_image):$(inputs.params.release_version)-context-amd64
imagebase: $(inputs.params.registry)/$(inputs.params.image):$(inputs.params.release_version)-context-amd64

labels:
quay.expires-after: Never

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: $(inputs.params.release_version)-amd64

- name: operator-ubi-arm64
- name: operator-arm64
vars:
context: .
template_context: scripts/dev/templates/operator

inputs:
- operator_image
- operator_image_dev
- image
- image_dev

platform: linux/arm64

Expand All @@ -143,7 +143,7 @@ images:
quay.expires-after: 48h

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev)
- registry: $(inputs.params.registry)/$(inputs.params.image_dev)
tag: $(inputs.params.version_id)-context-arm64

- name: operator-template-dev
Expand All @@ -165,15 +165,15 @@ images:
- version_id

buildargs:
imagebase: $(inputs.params.registry)/$(inputs.params.operator_image_dev):$(inputs.params.version_id)-context-arm64
imagebase: $(inputs.params.registry)/$(inputs.params.image_dev):$(inputs.params.version_id)-context-arm64

labels:
quay.expires-after: 48h

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev)
- registry: $(inputs.params.registry)/$(inputs.params.image_dev)
tag: $(inputs.params.version_id)-arm64
- registry: $(inputs.params.registry)/$(inputs.params.operator_image_dev)
- registry: $(inputs.params.registry)/$(inputs.params.image_dev)
tag: latest-arm64

#
Expand All @@ -196,7 +196,7 @@ images:
builder_image: $(inputs.params.builder_image)

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: $(inputs.params.release_version)-context-arm64

- name: operator-template-release
Expand All @@ -221,11 +221,11 @@ images:
dockerfile: scripts/dev/templates/operator/Dockerfile.operator-$(inputs.params.release_version)

buildargs:
imagebase: $(inputs.params.registry)/$(inputs.params.operator_image):$(inputs.params.release_version)-context-arm64
imagebase: $(inputs.params.registry)/$(inputs.params.image):$(inputs.params.release_version)-context-arm64

labels:
quay.expires-after: Never

output:
- registry: $(inputs.params.registry)/$(inputs.params.operator_image)
- registry: $(inputs.params.registry)/$(inputs.params.image)
tag: $(inputs.params.release_version)-arm64
Loading
Loading