|
| 1 | +# ENV VARS |
| 2 | +variables: |
| 3 | + CI_IMAGE: registry.ddbuild.io/ci/opentelemetry-collector-contrib:ci-image-2 |
| 4 | + BUILD_DD_REGISTRY: registry.ddbuild.io/ci/opentelemetry-collector-contrib |
| 5 | + BUILD_DEMO_REGISTRY: 172597598159.dkr.ecr.us-east-1.amazonaws.com/otel-collector-contrib |
| 6 | + BUILD_SANDBOX_REGISTRY: 601427279990.dkr.ecr.us-east-1.amazonaws.com/otel-collector-contrib |
| 7 | + SANDBOX_CLUSTER_NAME: dd-otel |
| 8 | + DEMO_CLUSTER_NAME: prod-eks-otel-a-us-east-1 |
| 9 | + SANDBOX_CLUSTER_ARN: "arn:aws:eks:us-east-1:601427279990:cluster/dd-otel" |
| 10 | + DEMO_CLUSTER_ARN: "arn:aws:eks:us-east-1:172597598159:cluster/prod-eks-otel-a-us-east-1" |
| 11 | + DEPLOY_SCRIPT: "./ci/scripts/ci-deploy.sh" |
| 12 | + # To use images from test-infra-definitions dev branches, set the SUFFIX variable to -dev |
| 13 | + # and check the job creating the image to make sure you have the right SHA prefix |
| 14 | + TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX: "" |
| 15 | + # Make sure to update test-infra-definitions version in go.mod as well |
| 16 | + TEST_INFRA_DEFINITIONS_BUILDIMAGES: b02a714d7de7 |
| 17 | + |
| 18 | + |
| 19 | +# BUILD STAGES |
| 20 | +stages: |
| 21 | + - build-and-push-ci-image |
| 22 | + - build-collector-image |
| 23 | + - push-collector-image |
| 24 | + - e2e |
| 25 | + - staging-deploy |
| 26 | + - prod-deploy |
| 27 | + |
| 28 | +# BUILD IMAGES |
| 29 | +build-ci-image: |
| 30 | + stage: build-and-push-ci-image |
| 31 | + tags: ["runner:docker"] |
| 32 | + image: $CI_IMAGE |
| 33 | + script: |
| 34 | + - TAG=ci-image-2 |
| 35 | + - docker build --file ci/Dockerfile.gitlab --tag $BUILD_DD_REGISTRY:$TAG . |
| 36 | + - docker push $BUILD_DD_REGISTRY:$TAG |
| 37 | + |
| 38 | +.build-collector-image: &build-collector-image |
| 39 | + stage: build-collector-image |
| 40 | + tags: ["runner:docker"] |
| 41 | + image: $CI_IMAGE |
| 42 | + script: |
| 43 | + - IMAGE_TAG_PREFIX=otelcolcontrib |
| 44 | + - TAG="$IMAGE_TAG_PREFIX-v$CI_COMMIT_SHORT_SHA" |
| 45 | + - docker build --file ci/Dockerfile --tag $BUILD_REGISTRY:$TAG --label target=staging . |
| 46 | + - docker push $BUILD_REGISTRY:$TAG |
| 47 | +build-collector-image-main: |
| 48 | + !!merge <<: *build-collector-image |
| 49 | + variables: |
| 50 | + BUILD_REGISTRY: $BUILD_DD_REGISTRY |
| 51 | + |
| 52 | +# PUSH IMAGES |
| 53 | +.push-collector-image: &push-collector-image |
| 54 | + stage: push-collector-image |
| 55 | + tags: ["runner:docker"] |
| 56 | + image: $CI_IMAGE |
| 57 | + dependencies: |
| 58 | + - build-collector-image-main |
| 59 | + script: |
| 60 | + - IMAGE_TAG_PREFIX=otelcolcontrib |
| 61 | + - TAG="$IMAGE_TAG_PREFIX-v$CI_COMMIT_SHORT_SHA" |
| 62 | + - docker pull $BUILD_DD_REGISTRY:$TAG |
| 63 | + - docker tag $BUILD_DD_REGISTRY:$TAG $BUILD_REGISTRY:$TAG |
| 64 | + - docker push $BUILD_REGISTRY:$TAG |
| 65 | +push-collector-image-demo: |
| 66 | + !!merge <<: *push-collector-image |
| 67 | + variables: |
| 68 | + BUILD_REGISTRY: $BUILD_DEMO_REGISTRY |
| 69 | +push-collector-image-staging: |
| 70 | + !!merge <<: *push-collector-image |
| 71 | + variables: |
| 72 | + BUILD_REGISTRY: $BUILD_SANDBOX_REGISTRY |
| 73 | +push-collector-image-agent-qa: |
| 74 | + stage: push-collector-image |
| 75 | + needs: ['build-collector-image-main'] |
| 76 | + trigger: |
| 77 | + project: DataDog/public-images |
| 78 | + branch: main |
| 79 | + strategy: depend |
| 80 | + variables: |
| 81 | + IMG_SOURCES: $BUILD_DD_REGISTRY:otelcolcontrib-v${CI_COMMIT_SHORT_SHA} |
| 82 | + IMG_DESTINATIONS: otel-collector-contrib:${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA} |
| 83 | + IMG_REGISTRIES: agent-qa |
| 84 | + |
| 85 | +# DEPLOY COLLECTOR STAGING |
| 86 | +.staging-deploy: &staging-deploy |
| 87 | + stage: staging-deploy |
| 88 | + tags: ["runner:docker", "size:large"] |
| 89 | + image: $CI_IMAGE |
| 90 | + dependencies: |
| 91 | + - push-collector-image-staging |
| 92 | + rules: |
| 93 | + - if: '$CI_COMMIT_REF_NAME =~ /-staging$/' |
| 94 | + script: |
| 95 | + - >- |
| 96 | + TEMP_AWS_ACCESS_KEY_ID=$(aws ssm get-parameter --region us-east-1 --name ci.opentelemetry-collector-contrib.sand-eks-deploy-api-key --with-decryption --query Parameter.Value --out text) |
| 97 | + - >- |
| 98 | + TEMP_AWS_SECRET_ACCESS_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.opentelemetry-collector-contrib.sand-eks-deploy-access-key --with-decryption --query Parameter.Value --out text) |
| 99 | + - export AWS_ACCESS_KEY_ID=$TEMP_AWS_ACCESS_KEY_ID |
| 100 | + - export AWS_SECRET_ACCESS_KEY=$TEMP_AWS_SECRET_ACCESS_KEY |
| 101 | + - bash $DEPLOY_SCRIPT |
| 102 | +#env:otel-staging |
| 103 | +staging-deploy: |
| 104 | + !!merge <<: *staging-deploy |
| 105 | + variables: |
| 106 | + CLUSTER_NAME: $SANDBOX_CLUSTER_NAME |
| 107 | + CLUSTER_ARN: $SANDBOX_CLUSTER_ARN |
| 108 | + NAMESPACE: otel-staging |
| 109 | + NODE_GROUP: ng-3 |
| 110 | + MODE: daemonset |
| 111 | + REPLICA_COUNT: 1 |
| 112 | + CLUSTER_ROLE: opentelemetry-collector |
| 113 | + REGISTRY: $BUILD_SANDBOX_REGISTRY |
| 114 | + |
| 115 | +#env:otel-gateway |
| 116 | +staging-deploy-gateway: |
| 117 | + !!merge <<: *staging-deploy |
| 118 | + variables: |
| 119 | + CLUSTER_NAME: $SANDBOX_CLUSTER_NAME |
| 120 | + CLUSTER_ARN: $SANDBOX_CLUSTER_ARN |
| 121 | + NAMESPACE: otel-gateway |
| 122 | + NODE_GROUP: ng-5 |
| 123 | + MODE: deployment |
| 124 | + REPLICA_COUNT: 3 |
| 125 | + CLUSTER_ROLE: opentelemetry-collector-gateway |
| 126 | + REGISTRY: $BUILD_SANDBOX_REGISTRY |
| 127 | + |
| 128 | +#env:otel-ds-gateway |
| 129 | +staging-deploy-ds-gateway: |
| 130 | + !!merge <<: *staging-deploy |
| 131 | + variables: |
| 132 | + CLUSTER_NAME: $SANDBOX_CLUSTER_NAME |
| 133 | + CLUSTER_ARN: $SANDBOX_CLUSTER_ARN |
| 134 | + NAMESPACE: otel-ds-gateway |
| 135 | + NODE_GROUP: ng-6 |
| 136 | + MODE: deployment |
| 137 | + REPLICA_COUNT: 3 |
| 138 | + CLUSTER_ROLE: opentelemetry-collector-ds-gateway |
| 139 | + REGISTRY: $BUILD_SANDBOX_REGISTRY |
| 140 | + |
| 141 | +# DEPLOY COLLECTOR PROD |
| 142 | +.prod-deploy: &prod-deploy-demo-eks |
| 143 | + stage: prod-deploy |
| 144 | + tags: ["runner:docker", "size:large"] |
| 145 | + image: $CI_IMAGE |
| 146 | + dependencies: |
| 147 | + - push-collector-image-demo |
| 148 | + rules: |
| 149 | + # changing to staging for testing purposes. |
| 150 | + - if: '$CI_COMMIT_REF_NAME == "prod"' |
| 151 | + script: |
| 152 | + - >- |
| 153 | + TEMP_AWS_ACCESS_KEY_ID=$(aws ssm get-parameter --region us-east-1 --name ci.opentelemetry-collector-contrib.eks_access_key --with-decryption --query Parameter.Value --out text) |
| 154 | + - >- |
| 155 | + TEMP_AWS_SECRET_ACCESS_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.opentelemetry-collector-contrib.eks_secret_access_key --with-decryption --query Parameter.Value --out text) |
| 156 | + - export AWS_ACCESS_KEY_ID=$TEMP_AWS_ACCESS_KEY_ID |
| 157 | + - export AWS_SECRET_ACCESS_KEY=$TEMP_AWS_SECRET_ACCESS_KEY |
| 158 | + - bash $DEPLOY_SCRIPT |
| 159 | +#env:otel |
| 160 | +prod-deploy: |
| 161 | + !!merge <<: *prod-deploy-demo-eks |
| 162 | + variables: |
| 163 | + CLUSTER_NAME: $DEMO_CLUSTER_NAME |
| 164 | + CLUSTER_ARN: $DEMO_CLUSTER_ARN |
| 165 | + NAMESPACE: otel |
| 166 | + NODE_GROUP: |
| 167 | + MODE: daemonset |
| 168 | + REPLICA_COUNT: 1 |
| 169 | + CLUSTER_ROLE: opentelemetry-collector |
| 170 | + REGISTRY: $BUILD_DEMO_REGISTRY |
| 171 | + |
| 172 | +.new_e2e_template: |
| 173 | + stage: e2e |
| 174 | + image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/test-infra-definitions/runner$TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX:$TEST_INFRA_DEFINITIONS_BUILDIMAGES |
| 175 | + tags: ["arch:amd64"] |
| 176 | + before_script: |
| 177 | + # Setup AWS Credentials |
| 178 | + - mkdir -p ~/.aws |
| 179 | + - aws ssm get-parameter --region us-east-1 --name "ci.opentelemetry-collector-contrib.agent-qa-profile" --with-decryption --query "Parameter.Value" --output text >> ~/.aws/config |
| 180 | + - export AWS_PROFILE=agent-qa-ci |
| 181 | + # Now all `aws` commands target the agent-qa profile |
| 182 | + - aws ssm get-parameter --region us-east-1 --name "ci.opentelemetry-collector-contrib.ssh_public_key" --with-decryption --query "Parameter.Value" --output text > $E2E_PUBLIC_KEY_PATH |
| 183 | + - touch $E2E_PRIVATE_KEY_PATH && chmod 600 $E2E_PRIVATE_KEY_PATH && aws ssm get-parameter --region us-east-1 --name "ci.opentelemetry-collector-contrib.ssh_private_key" --with-decryption --query "Parameter.Value" --output text > $E2E_PRIVATE_KEY_PATH |
| 184 | + # Use S3 backend |
| 185 | + - pulumi login "s3://dd-pulumi-state?region=us-east-1&awssdk=v2&profile=$AWS_PROFILE" |
| 186 | + variables: |
| 187 | + KUBERNETES_MEMORY_REQUEST: 12Gi |
| 188 | + KUBERNETES_MEMORY_LIMIT: 16Gi |
| 189 | + KUBERNETES_CPU_REQUEST: 6 |
| 190 | + E2E_PIPELINE_ID: $CI_PIPELINE_ID |
| 191 | + E2E_COMMIT_SHORT_SHA: $CI_COMMIT_SHORT_SHA |
| 192 | + E2E_PUBLIC_KEY_PATH: /tmp/agent-qa-ssh-key.pub |
| 193 | + E2E_PRIVATE_KEY_PATH: /tmp/agent-qa-ssh-key |
| 194 | + E2E_KEY_PAIR_NAME: ci.open-telemetry-collector-contrib |
| 195 | + E2E_OUTPUT_DIR: $CI_PROJECT_DIR/e2e-output |
| 196 | + E2E_PULUMI_VERBOSE_PROGRESS_STREAMS: true |
| 197 | + script: |
| 198 | + - cd e2e-tests && go test $TARGETS/... -v -timeout 0 --args -docker_secret $(aws ecr get-login-password) |
| 199 | + |
| 200 | +new-e2e-otel-collector: |
| 201 | + extends: .new_e2e_template |
| 202 | + needs: ['push-collector-image-agent-qa'] |
| 203 | + variables: |
| 204 | + TARGETS: ./tests |
| 205 | + TEAM: otel |
0 commit comments