Migrate from Legacy Jobs
CloudOps for Kubernetes now provides V2 Pipelines as the recommended path for new Self-Managed Commerce build, test, and deployment automation.
All legacy jobs remain available during the transition, but teams should plan to adopt the V2 jobs for future work.
The V2 model improves on the older Jenkins workflows in several important ways. For details, see V2 Pipelines Overview
Approach Overview
The overall approach to adopting the new V2 pipelines is:
-
Convert your container image build to use the
v2-build-commerce-imagesbuild job.-
First, ensure that your
ep-commercebranch contains the Build Tools code. See Update yourep-commerceCode. -
Then update your code build workflow to call the new V2
v2-build-commerce-imagesjob instead of the older jobs.When this is complete, you no longer need to use, manage, or update the Elastic Path
dockerproject. The V2 build jobs use container configuration files exclusively from theep-commerceproject. Remember to keep up to date with theep-commercepatches.
-
-
Update your code deployment workflow to call the new
v2-deploy-commerce-imagesjob instead of the older jobs.When both of the above are complete, your build and deploy pipeline becomes simpler: run
v2-build-commerce-imagesto build new code and then runv2-deploy-commerce-imagesto apply the images to a Commerce environment. -
Migrate your environment configuration to the new file-based configuration.
-
Begin with a lower environment (for example, a development environment).
-
Roll out to higher environments (for example, staging).
-
Roll out to production.
-
Going forward, run the V2
v2-configure-commerce-environmentjob when you want to apply either Terraform updates or your configuration file updates.When this is complete, all of your Commerce environment configuration is tracked in and driven by files in Git. You can use Git's approval workflow to review changes before they are applied, and the change history to track when changes were made, and why.
-
The sections below provide more detail on each of these.
The V2 build job, V2 deployment job, and V2 configuration job are independent of each other. Teams can adopt them in whichever order makes sense for them.
Update your ep-commerce Code
Your application development team should ensure that your Self-Managed Commerce ep-commerce branch includes the Self-Managed Commerce Build Tools code. Then your DevOps and development teams should confirm that any Elastic Path docker customizations are migrated to the ep-commerce Build Tools files.
Self-Managed Commerce releases 8.2.x and earlier are not compatible with Build Tools and the new CloudOps for Kubernetes V2 pipelines.
Consume Build Tools patches
As a guide, check that your ep-commerce branch includes the paths listed below.
devops/build_tools_extras/configure_build_host.shdevops/build_tools/build_source_tree.shdevops/build_tools/build_container_layout.shdevops/build_tools/build_base_images.ymldevops/build_tools/build_commerce_images.yml
The initial release of Self-Managed Commerce 8.8.x included the required files. The initial release of Self-Managed Commerce 8.7.x included some of the files, but patches are required for others. These files were not included in the initial release of Self-Managed Commerce 8.6.x or earlier, and are provided as patches. In all releases, new patches provide improvements and address security concerns.
Apply the Self-Managed Commerce patches to ensure that you have the required Build Tools code and updates. See Consuming Support Fixes for instructions on obtaining and applying Self-Managed Commerce patches.
Recent Build Tools patches are identified with the Build Tools badge in the release notes pages.
Migrate Elastic Path docker Customizations to ep-commerce
If your team has implemented any customizations in the Elastic Path docker project, identify those and migrate them to the Build Tools files. The paths to some of the commonly customized files are shared below.
- Commerce application Dockerfiles are found under
extensions/packager/ext-container-layout/src/main/files/*.Dockerfile - The Tomcat base image Dockerfile is found at
devops/build_tools/roles/tomcat/templates/Dockerfile.j2 - The Tomcat configuration files are found at
devops/build_tools/roles/tomcat/files - The Java base image Dockerfile is found at
devops/build_tools/roles/amazonlinux_java/templates/Dockerfile.j2 - The ActiveMQ image Dockerfile is found at
devops/build_tools/roles/activemq/templates/Dockerfile.j2
Switching Build Jobs
The various "legacy" build jobs listed in the table below are replaced with two new V2 builds jobs.
| Legacy job | V2 replacement job | Notes |
|---|---|---|
build-deployment-package |
v2-build-commerce-maven-artifacts |
In the legacy jobs, the build-deployment-package job compiled all of the application binaries. This is now performed by the v2-build-commerce-maven-artifacts job. |
build-core-images |
v2-build-commerce-images |
All base and application images, plus ep/info-page, are now built by the v2-build-commerce-images job. |
build-commerce-images | ||
build-selected-images | ||
build-activemq | ||
build-base-image | ||
build-batch | ||
build-cm | ||
build-cortex | ||
build-data-pop | ||
build-data-sync | ||
build-integration | ||
build-mock | ||
build-mysql | ||
build-search | ||
build-infopage |
The new v2-build-commerce-maven-artifacts and v2-build-commerce-images use images with specific image tags to identify and pass the correct Maven artifacts and build output. The default image tag is the ep-commerce project's short commit hash.
You can run just the v2-build-commerce-images job. If the required commerce-maven-artifacts image already exists in ECR, then the job will use it. Otherwise the v2-build-commerce-images job will call the v2-build-commerce-maven-artifacts job to build it.
For more information, see V2 Builds and Artifacts.
Switching Deploy Jobs
The legacy deploy jobs listed in the table below are replaced by the v2-deploy-commerce-images job.
| Legacy job | V2 replacement job | Notes |
|---|---|---|
Using pull-docker-images to re-tag images within the same account. |
v2-deploy-commerce-images |
The v2-deploy-commerce-images job can re-tag images (optional), update the specified Commerce environment to use the specified image tag, and run data-pop (optional). |
run-data-pop-tool | ||
restart-commerce-stack |
Continue to use pull-docker-images when you need to pull images across AWS accounts, such as from non-production into production.
Switching Configuration Jobs
The legacy configuration jobs listed in the table below are replaced by the v2-configure-commerce-environment job.
| Legacy job | V2 replacement job | Notes |
|---|---|---|
deploy-or-delete-commerce-stack |
v2-configure-commerce-environment |
The database server, ActiveMQ and Commerce stack can now all be created, updated or re-configured using YAML files and the v2-configure-commerce-environment job. |
create-and-manage-database-server | ||
create-or-delete-mysql-container | ||
create-or-delete-activemq-container | ||
use-existing-database-server |
For more information, see Configuring Environments with V2 Pipelines and Environment Files Reference.
Use the v2-destroy-commerce-environment job when you want to delete a Commerce environment.
New Operations Jobs
v2-deploy-commerce-images
Use the new job v2-deploy-commerce-images to deploy new Commerce images to an existing Commerce environment. This job can optionally re-tag the images before deploying, or optionally run data-population update-db if data-pop is required.
This job does not apply Terraform configuration changes, making it better for code deployments than the new v2-configure-commerce-environment job and the deploy-or-delete-commerce-stack job.
You can start using the v2-deploy-commerce-images job for Commerce deployments without needing to change how you configure your environments or how you build your Commerce images. You do not need to adopt other V2 jobs to use this job for deployments.
v2-set-commerce-service-replicas
Use this job to scale one of the following Commerce services to a specific number of replicas:
cortexsearch-slaveintegration
v2-stop-start-commerce-environment
Use this job to scale down all of the Kubernetes services in a Commerce environment's namespace, to effectively turn off the environment.
Switching Test Jobs
The various "legacy" test jobs listed in the table below are replaced with two new V2 test jobs.
| Legacy job | V2 replacement job | Notes |
|---|---|---|
run-cortex-system-tests |
v2-run-cortex-system-tests |
The V2 job behaves the same but now calls the devops/build_tools/run-cortex-system-tests.sh Build Tools script, from the ep-commerce project. |
commerce-branch-validation |
v2-commerce-branch-validation |
The V2 job leverages the new V2 build and deployment jobs, and uses the component templates in environments/branch-validation-template/. |
You can update or modify the templates in environments/branch-validation-template/ if you need to tune the configuration of the ephemeral test environments used in the v2-commerce-branch-validation job.
Migrating a Running V1 Environment to V2
The job and table mappings above describe which V2 jobs replace which legacy jobs. If you have a long-lived environment that was originally created and is currently managed by V1 jobs, you also need V2 environment files before you can use v2-configure-commerce-environment to manage it.
Before you generate the files, choose a database approach and update the environment from the target branch by running the legacy ActiveMQ and Commerce stack jobs. If you want V2 to manage the database server configuration, also run the legacy job for your database implementation. Let each job finish applying. Otherwise, Terraform module changes that were never applied appear as planned changes during validation. For the job list and database options, see Before You Run the Job.
Then use the v2-generate-env-files-for-existing-environment job to generate those files automatically.
The job inspects the running environment and produces ready-to-review component YAML artifacts under generated-env-<kubernetesNickname>/. After you review and commit them under environments/<kubernetesNickname>/, you can replace the V1 legacy deploy jobs with v2-configure-commerce-environment for all future updates to that environment.
For full details on the job parameters, the databaseAdoptionApproach options, and the post-run steps, see Generate Environment Files for an Existing Environment.