From f91730defd7e698d69853a6d721710949640cbde Mon Sep 17 00:00:00 2001 From: Kacper Date: Mon, 13 Nov 2023 14:19:09 +0100 Subject: [PATCH 01/20] Add flag to build-rc for staging deployments --- tasks/libs/pipeline_tools.py | 4 ++++ tasks/pipeline.py | 2 ++ tasks/release.py | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tasks/libs/pipeline_tools.py b/tasks/libs/pipeline_tools.py index 4905c5674910d4..bac08bb919d18b 100644 --- a/tasks/libs/pipeline_tools.py +++ b/tasks/libs/pipeline_tools.py @@ -88,6 +88,7 @@ def trigger_agent_pipeline( deploy=False, all_builds=False, kitchen_tests=False, + rc_staging_deployments=False, ): """ Trigger a pipeline on the datadog-agent repositories. Multiple options are available: @@ -123,6 +124,9 @@ def trigger_agent_pipeline( if branch is not None: args["BUCKET_BRANCH"] = branch + if rc_staging_deployments: + args["RC_STAGING_DEPLOYMENTS"] = "true" + print( "Creating pipeline for datadog-agent on branch/tag {} with args:\n{}".format( # noqa: FS002 ref, "\n".join(f" - {k}: {args[k]}" for k in args) diff --git a/tasks/pipeline.py b/tasks/pipeline.py index 798751e456a03f..4fd4ca7d73bcb6 100644 --- a/tasks/pipeline.py +++ b/tasks/pipeline.py @@ -211,6 +211,7 @@ def run( deploy=False, all_builds=True, kitchen_tests=True, + rc_staging_deployments=False, ): """ Run a pipeline on the given git ref (--git-ref ), or on the current branch if --here is given. @@ -311,6 +312,7 @@ def run( deploy=deploy, all_builds=all_builds, kitchen_tests=kitchen_tests, + rc_staging_deployments=rc_staging_deployments, ) except FilteredOutException: print(color_message(f"ERROR: pipeline does not match any workflow rule. Rules:\n{workflow_rules()}", "red")) diff --git a/tasks/release.py b/tasks/release.py index 87832b7969dad7..33089d22671dc2 100644 --- a/tasks/release.py +++ b/tasks/release.py @@ -1132,11 +1132,13 @@ def create_rc(ctx, major_versions="6,7", patch_version=False, upstream="origin") @task -def build_rc(ctx, major_versions="6,7", patch_version=False): +def build_rc(ctx, major_versions="6,7", patch_version=False, staging_deployments=False): """ To be done after the PR created by release.create-rc is merged, with the same options as release.create-rc. + staging_deployments - when set to True the child pipeline deploying to k8s staging clusters would be triggred. + Tags the new RC versions on the current commit, and creates the build pipeline for these new tags. """ @@ -1206,6 +1208,7 @@ def build_rc(ctx, major_versions="6,7", patch_version=False): major_versions=major_versions, repo_branch="beta", deploy=True, + rc_staging_deployments=staging_deployments, ) From 5caea0717632384f8546c635e98880eb86f343ec Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 14 Nov 2023 09:09:29 +0100 Subject: [PATCH 02/20] Deployment job added for test --- .gitlab/rc_kubernetes_deploy.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .gitlab/rc_kubernetes_deploy.yml diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml new file mode 100644 index 00000000000000..063df49dd9c630 --- /dev/null +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -0,0 +1,31 @@ +--- +# rc_kubernetes_deploy stage +# Contains jobs to trigger a pipeline in our k8s-datadog-agent-ops repo to deploy release candidate build + +rc_kubernetes_deploy_experimental: + stage: rc_kubernetes_deploy + rules: + - if: $RC_STAGING_DEPLOYMENTS == "true" + when: always + # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing + when: always + - !reference [.on_deploy_a7] + needs: + - job: docker_trigger_internal + artifacts: false + - job: docker_trigger_cluster_agent_internal + artifacts: false + - job: k8s-e2e-main # Currently only require container Argo workflow + artifacts: false + optional: true + image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES + tags: ["arch:amd64"] + variables: + OPTION_AUTOMATIC_ROLLOUT: "true" + OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging ${CI_COMMIT_REF_SLUG}-jmx-${CI_COMMIT_SHORT_SHA} ${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" + SKIP_PLAN_CHECK: "true" + EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" + script: + - source /root/.bashrc + - export GITLAB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.gitlab_pipelines_scheduler_token --with-decryption --query "Parameter.Value" --out text) + - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow From 60ed9c3021f7d95d6e4b97bdf91779714f545d5b Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 14 Nov 2023 11:09:31 +0100 Subject: [PATCH 03/20] Test parameters --- .gitlab-ci.yml | 2 ++ .gitlab/rc_kubernetes_deploy.yml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b6765c5943d39..36e05a8cff5f1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,6 +47,7 @@ include: - /.gitlab/kitchen_common/testing.yml - /.gitlab/benchmarks/benchmarks.yml - /.gitlab/benchmarks/macrobenchmarks.yml + - ./gitlab/rc_kubernetes_deploy.yaml default: retry: @@ -60,6 +61,7 @@ default: stages: - .pre - setup + - rc_kubernetes_deploy - maintenance_jobs - deps_build - deps_fetch diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 063df49dd9c630..0a3ef181215886 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -28,4 +28,6 @@ rc_kubernetes_deploy_experimental: script: - source /root/.bashrc - export GITLAB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.gitlab_pipelines_scheduler_token --with-decryption --query "Parameter.Value" --out text) - - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow + #- inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow + - echo $CI_COMMIT_REF_SLUG + - echo $CI_COMMIT_SHORT_SHA From 73ed523a912a17c66b734839597baa5a4c2e29bb Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 14 Nov 2023 11:11:35 +0100 Subject: [PATCH 04/20] Filename typo --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36e05a8cff5f1d..40b272deab0538 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ include: - /.gitlab/kitchen_common/testing.yml - /.gitlab/benchmarks/benchmarks.yml - /.gitlab/benchmarks/macrobenchmarks.yml - - ./gitlab/rc_kubernetes_deploy.yaml + - ./gitlab/rc_kubernetes_deploy.yml default: retry: From 3ff78eeac6d28244069014850ff86dc12080e178 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 14 Nov 2023 11:13:13 +0100 Subject: [PATCH 05/20] Filename typo 2 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 40b272deab0538..541587e5d9a79a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ include: - /.gitlab/kitchen_common/testing.yml - /.gitlab/benchmarks/benchmarks.yml - /.gitlab/benchmarks/macrobenchmarks.yml - - ./gitlab/rc_kubernetes_deploy.yml + - /.gitlab/rc_kubernetes_deploy.yml default: retry: From 08906c5271ebe4ae0b7edde9a6cb57e98654cbf7 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 14 Nov 2023 11:14:17 +0100 Subject: [PATCH 06/20] Remove needs for test purpose --- .gitlab/rc_kubernetes_deploy.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 0a3ef181215886..d2cc447618e7ea 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -10,14 +10,14 @@ rc_kubernetes_deploy_experimental: # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing when: always - !reference [.on_deploy_a7] - needs: - - job: docker_trigger_internal - artifacts: false - - job: docker_trigger_cluster_agent_internal - artifacts: false - - job: k8s-e2e-main # Currently only require container Argo workflow - artifacts: false - optional: true + # needs: + # - job: docker_trigger_internal + # artifacts: false + # - job: docker_trigger_cluster_agent_internal + # artifacts: false + # - job: k8s-e2e-main # Currently only require container Argo workflow + # artifacts: false + # optional: true image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES tags: ["arch:amd64"] variables: From c26f30fcff3e440a39faa7ef9f998e62289ed257 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 14 Nov 2023 11:18:30 +0100 Subject: [PATCH 07/20] Remove rules for test purpose --- .gitlab/rc_kubernetes_deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index d2cc447618e7ea..3993f3281561c5 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -4,12 +4,12 @@ rc_kubernetes_deploy_experimental: stage: rc_kubernetes_deploy - rules: - - if: $RC_STAGING_DEPLOYMENTS == "true" - when: always + # rules: + # - if: $RC_STAGING_DEPLOYMENTS == "true" + # when: always # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing - when: always - - !reference [.on_deploy_a7] + # when: always + # - !reference [.on_deploy_a7] # needs: # - job: docker_trigger_internal # artifacts: false From 2ffe4884257f21330ade5e07f3ce24c97c2a8132 Mon Sep 17 00:00:00 2001 From: Kacper Date: Wed, 15 Nov 2023 09:20:32 +0100 Subject: [PATCH 08/20] Test workflow trigger --- .gitlab/rc_kubernetes_deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 3993f3281561c5..9419508d6cc167 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -22,12 +22,12 @@ rc_kubernetes_deploy_experimental: tags: ["arch:amd64"] variables: OPTION_AUTOMATIC_ROLLOUT: "true" - OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging ${CI_COMMIT_REF_SLUG}-jmx-${CI_COMMIT_SHORT_SHA} ${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" + OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging 7.50.0-rc.2-jmx-d99ab6ec 7.50.0-rc.2-d99ab6ec" SKIP_PLAN_CHECK: "true" EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" script: - source /root/.bashrc - export GITLAB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.gitlab_pipelines_scheduler_token --with-decryption --query "Parameter.Value" --out text) - #- inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow - - echo $CI_COMMIT_REF_SLUG - - echo $CI_COMMIT_SHORT_SHA + - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow + + From 46868bd5c304f11f18d9e63d181533577ff90723 Mon Sep 17 00:00:00 2001 From: Kacper Date: Wed, 15 Nov 2023 09:25:00 +0100 Subject: [PATCH 09/20] Change to retrigger the pipeline --- .gitlab/rc_kubernetes_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 9419508d6cc167..e64ad68282695b 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -7,7 +7,7 @@ rc_kubernetes_deploy_experimental: # rules: # - if: $RC_STAGING_DEPLOYMENTS == "true" # when: always - # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing + # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing # when: always # - !reference [.on_deploy_a7] # needs: From 8aac26cd3eed113d309931beb5e13f03b4c1b32b Mon Sep 17 00:00:00 2001 From: Kacper Date: Wed, 15 Nov 2023 10:07:23 +0100 Subject: [PATCH 10/20] Pipeline trigger --- .gitlab/rc_kubernetes_deploy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index e64ad68282695b..cf5ac253017326 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -29,5 +29,4 @@ rc_kubernetes_deploy_experimental: - source /root/.bashrc - export GITLAB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.gitlab_pipelines_scheduler_token --with-decryption --query "Parameter.Value" --out text) - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow - - + \ No newline at end of file From bdc4952bf63ab1043302735e5b964b702b13592e Mon Sep 17 00:00:00 2001 From: Kacper Date: Wed, 15 Nov 2023 10:14:35 +0100 Subject: [PATCH 11/20] Pipeline trigger --- .gitlab/rc_kubernetes_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index cf5ac253017326..dc9396e734849d 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -27,6 +27,6 @@ rc_kubernetes_deploy_experimental: EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" script: - source /root/.bashrc + - echo "Test" - export GITLAB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.gitlab_pipelines_scheduler_token --with-decryption --query "Parameter.Value" --out text) - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow - \ No newline at end of file From 170702b42589854ed816eb2c470d08276b815beb Mon Sep 17 00:00:00 2001 From: Kacper Date: Wed, 15 Nov 2023 11:42:20 +0100 Subject: [PATCH 12/20] Pipeline trigger --- .gitlab/rc_kubernetes_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index dc9396e734849d..672eacbdb38d59 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -10,6 +10,7 @@ rc_kubernetes_deploy_experimental: # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing # when: always # - !reference [.on_deploy_a7] + # needs: # - job: docker_trigger_internal # artifacts: false From 8ec26303aeb32441a0eb6dec0f99086232598fcc Mon Sep 17 00:00:00 2001 From: Kacper Date: Wed, 15 Nov 2023 12:20:23 +0100 Subject: [PATCH 13/20] Image references fix --- .gitlab/rc_kubernetes_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 672eacbdb38d59..8f3fc8136c5f13 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -10,7 +10,7 @@ rc_kubernetes_deploy_experimental: # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing # when: always # - !reference [.on_deploy_a7] - + # needs: # - job: docker_trigger_internal # artifacts: false @@ -23,7 +23,7 @@ rc_kubernetes_deploy_experimental: tags: ["arch:amd64"] variables: OPTION_AUTOMATIC_ROLLOUT: "true" - OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging 7.50.0-rc.2-jmx-d99ab6ec 7.50.0-rc.2-d99ab6ec" + OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging 7.50.0-rc.2-jmx 7.50.0-rc.2" SKIP_PLAN_CHECK: "true" EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" script: From 2788428fc1280a9798ed5cb219ddc5b178a87fe9 Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 16 Nov 2023 14:49:56 +0100 Subject: [PATCH 14/20] Test with new image tag --- .gitlab/rc_kubernetes_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 8f3fc8136c5f13..913640e3b30c18 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -23,7 +23,7 @@ rc_kubernetes_deploy_experimental: tags: ["arch:amd64"] variables: OPTION_AUTOMATIC_ROLLOUT: "true" - OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging 7.50.0-rc.2-jmx 7.50.0-rc.2" + OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging 7.50.0-rc.3-jmx 7.50.0-rc.3" SKIP_PLAN_CHECK: "true" EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" script: From 786980e7804f38f2de32c850b15a94839ff3431a Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 16 Nov 2023 14:56:10 +0100 Subject: [PATCH 15/20] Trigger pipeline --- .gitlab/rc_kubernetes_deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 913640e3b30c18..d902cd264dfb04 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -10,7 +10,6 @@ rc_kubernetes_deploy_experimental: # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing # when: always # - !reference [.on_deploy_a7] - # needs: # - job: docker_trigger_internal # artifacts: false From efbd790979556f2beeb47ffc2bf05f1b70ca5e37 Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 16 Nov 2023 15:12:56 +0100 Subject: [PATCH 16/20] Trigger pipeline --- .gitlab/rc_kubernetes_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index d902cd264dfb04..0876b14abd3324 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -10,6 +10,7 @@ rc_kubernetes_deploy_experimental: # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing # when: always # - !reference [.on_deploy_a7] + # needs: # - job: docker_trigger_internal # artifacts: false From 897114d7813951398f11fb3248b470c9d6c0124c Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 16 Nov 2023 15:44:37 +0100 Subject: [PATCH 17/20] Trigger pipeline --- .gitlab/rc_kubernetes_deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 0876b14abd3324..d902cd264dfb04 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -10,7 +10,6 @@ rc_kubernetes_deploy_experimental: # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing # when: always # - !reference [.on_deploy_a7] - # needs: # - job: docker_trigger_internal # artifacts: false From 34e455cba068bf01ceabaf6191ed475ed33c20bf Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 16 Nov 2023 16:34:37 +0100 Subject: [PATCH 18/20] Trigger pipeline --- .gitlab/rc_kubernetes_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index d902cd264dfb04..bc5cba0dd3193f 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -11,6 +11,7 @@ rc_kubernetes_deploy_experimental: # when: always # - !reference [.on_deploy_a7] # needs: + # - job: docker_trigger_internal # artifacts: false # - job: docker_trigger_cluster_agent_internal From 4631e9090ff2a283f511a5b33712c8c16da81e8c Mon Sep 17 00:00:00 2001 From: Kacper Date: Fri, 17 Nov 2023 11:41:38 +0100 Subject: [PATCH 19/20] Clean up from test values --- .gitlab-ci.yml | 1 - .gitlab/rc_kubernetes_deploy.yml | 36 ++++++++++++++------------------ tasks/libs/pipeline_tools.py | 6 +++--- tasks/pipeline.py | 4 ++-- tasks/release.py | 6 +++--- 5 files changed, 24 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 541587e5d9a79a..d1436698cab551 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,7 +61,6 @@ default: stages: - .pre - setup - - rc_kubernetes_deploy - maintenance_jobs - deps_build - deps_fetch diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index bc5cba0dd3193f..9711572669750c 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -1,33 +1,29 @@ --- -# rc_kubernetes_deploy stage +# internal_kubernetes_deploy stage # Contains jobs to trigger a pipeline in our k8s-datadog-agent-ops repo to deploy release candidate build -rc_kubernetes_deploy_experimental: - stage: rc_kubernetes_deploy - # rules: - # - if: $RC_STAGING_DEPLOYMENTS == "true" - # when: always - # - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH =~ /7\.\d{2}\.x/' TODO - uncomment when done with testing - # when: always - # - !reference [.on_deploy_a7] - # needs: - - # - job: docker_trigger_internal - # artifacts: false - # - job: docker_trigger_cluster_agent_internal - # artifacts: false - # - job: k8s-e2e-main # Currently only require container Argo workflow - # artifacts: false - # optional: true +rc_kubernetes_deploy: + stage: internal_kubernetes_deploy + rules: + - if: $RC_K8S_DEPLOYMENTS == "true" + when: always + - !reference [.on_deploy_a7] + needs: + - job: docker_trigger_internal + artifacts: false + - job: docker_trigger_cluster_agent_internal + artifacts: false + - job: k8s-e2e-main # Currently only require container Argo workflow + artifacts: false + optional: true image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES tags: ["arch:amd64"] variables: OPTION_AUTOMATIC_ROLLOUT: "true" - OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging 7.50.0-rc.3-jmx 7.50.0-rc.3" + OPTION_PRE_SCRIPT: "patch-cluster-images-operator.sh env=all-staging ${CI_COMMIT_REF_SLUG}-jmx ${CI_COMMIT_REF_SLUG}" SKIP_PLAN_CHECK: "true" EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" script: - source /root/.bashrc - - echo "Test" - export GITLAB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.gitlab_pipelines_scheduler_token --with-decryption --query "Parameter.Value" --out text) - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow diff --git a/tasks/libs/pipeline_tools.py b/tasks/libs/pipeline_tools.py index bac08bb919d18b..d830252410db72 100644 --- a/tasks/libs/pipeline_tools.py +++ b/tasks/libs/pipeline_tools.py @@ -88,7 +88,7 @@ def trigger_agent_pipeline( deploy=False, all_builds=False, kitchen_tests=False, - rc_staging_deployments=False, + rc_k8s_deployments=False, ): """ Trigger a pipeline on the datadog-agent repositories. Multiple options are available: @@ -124,8 +124,8 @@ def trigger_agent_pipeline( if branch is not None: args["BUCKET_BRANCH"] = branch - if rc_staging_deployments: - args["RC_STAGING_DEPLOYMENTS"] = "true" + if rc_k8s_deployments: + args["RC_K8S_DEPLOYMENTS"] = "true" print( "Creating pipeline for datadog-agent on branch/tag {} with args:\n{}".format( # noqa: FS002 diff --git a/tasks/pipeline.py b/tasks/pipeline.py index 4fd4ca7d73bcb6..360d551affd50b 100644 --- a/tasks/pipeline.py +++ b/tasks/pipeline.py @@ -211,7 +211,7 @@ def run( deploy=False, all_builds=True, kitchen_tests=True, - rc_staging_deployments=False, + rc_k8s_deployments=False, ): """ Run a pipeline on the given git ref (--git-ref ), or on the current branch if --here is given. @@ -312,7 +312,7 @@ def run( deploy=deploy, all_builds=all_builds, kitchen_tests=kitchen_tests, - rc_staging_deployments=rc_staging_deployments, + rc_k8s_deployments=rc_k8s_deployments, ) except FilteredOutException: print(color_message(f"ERROR: pipeline does not match any workflow rule. Rules:\n{workflow_rules()}", "red")) diff --git a/tasks/release.py b/tasks/release.py index 33089d22671dc2..48d219abbbb36b 100644 --- a/tasks/release.py +++ b/tasks/release.py @@ -1132,12 +1132,12 @@ def create_rc(ctx, major_versions="6,7", patch_version=False, upstream="origin") @task -def build_rc(ctx, major_versions="6,7", patch_version=False, staging_deployments=False): +def build_rc(ctx, major_versions="6,7", patch_version=False, k8s_deployments=False): """ To be done after the PR created by release.create-rc is merged, with the same options as release.create-rc. - staging_deployments - when set to True the child pipeline deploying to k8s staging clusters would be triggred. + k8s_deployments - when set to True the child pipeline deploying to subset of k8s staging clusters would be triggered. Tags the new RC versions on the current commit, and creates the build pipeline for these new tags. @@ -1208,7 +1208,7 @@ def build_rc(ctx, major_versions="6,7", patch_version=False, staging_deployments major_versions=major_versions, repo_branch="beta", deploy=True, - rc_staging_deployments=staging_deployments, + rc_k8s_deployments=k8s_deployments, ) From be168557b4e515bed07136a730a493fe2d381e36 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 21 Nov 2023 10:29:45 +0100 Subject: [PATCH 20/20] Updates after review --- .gitlab/rc_kubernetes_deploy.yml | 3 ++- tasks/release.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab/rc_kubernetes_deploy.yml b/.gitlab/rc_kubernetes_deploy.yml index 9711572669750c..805eebdeff9ddf 100644 --- a/.gitlab/rc_kubernetes_deploy.yml +++ b/.gitlab/rc_kubernetes_deploy.yml @@ -25,5 +25,6 @@ rc_kubernetes_deploy: EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" script: - source /root/.bashrc + - set +x - export GITLAB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.gitlab_pipelines_scheduler_token --with-decryption --query "Parameter.Value" --out text) - - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "kacper-murzyn/rc-automatic-deployments" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow + - inv pipeline.trigger-child-pipeline --project-name "DataDog/k8s-datadog-agent-ops" --git-ref "main" --variables "OPTION_AUTOMATIC_ROLLOUT,EXPLICIT_WORKFLOWS,OPTION_PRE_SCRIPT,SKIP_PLAN_CHECK" --no-follow diff --git a/tasks/release.py b/tasks/release.py index 48d219abbbb36b..573289759fd4b1 100644 --- a/tasks/release.py +++ b/tasks/release.py @@ -1137,7 +1137,7 @@ def build_rc(ctx, major_versions="6,7", patch_version=False, k8s_deployments=Fal To be done after the PR created by release.create-rc is merged, with the same options as release.create-rc. - k8s_deployments - when set to True the child pipeline deploying to subset of k8s staging clusters would be triggered. + k8s_deployments - when set to True the child pipeline deploying to subset of k8s staging clusters will be triggered. Tags the new RC versions on the current commit, and creates the build pipeline for these new tags.