Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
123 changes: 27 additions & 96 deletions .claude/skills/handling-dependency-prs/SKILL.md

Large diffs are not rendered by default.

37 changes: 8 additions & 29 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
variables:
CURRENT_STAGING: staging-48
APP: 'browser-sdk'
CURRENT_CI_IMAGE: 137
BUILD_STABLE_REGISTRY: 'registry.ddbuild.io'
CI_IMAGE: '$BUILD_STABLE_REGISTRY/ci/$APP:$CURRENT_CI_IMAGE'
GIT_REPOSITORY: 'git@github.com:DataDog/browser-sdk.git'
MAIN_BRANCH: 'main'
NEXT_MAJOR_BRANCH: ''
Expand All @@ -29,8 +27,8 @@ cache:
- .yarn/cache

stages:
- task
- ci-image
- task
- test
- after-tests
- browserstack
Expand Down Expand Up @@ -131,30 +129,9 @@ stages:
# CI image
########################################################################################################################

# Builds the image when its inputs change and gives CI_IMAGE to the other jobs: see .gitlab/ci-image.yml
ci-image:
stage: ci-image
extends:
- .base-configuration
- .feature-branches
when: manual
tags: ['arch:amd64']
image: $BUILD_STABLE_REGISTRY/images/docker:27.3.1
id_tokens:
DDSIGN_ID_TOKEN:
aud: image-integrity
script:
- METADATA_FILE=$(mktemp)
- PLAYWRIGHT_VERSION=$(jq -r '.devDependencies["@playwright/test"]' package.json)
- >
docker buildx build
--platform linux/amd64
--build-arg CHROME_PACKAGE_VERSION=$CHROME_PACKAGE_VERSION
--build-arg PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION
--tag $CI_IMAGE
--push
--metadata-file $METADATA_FILE
.
- ddsign sign $CI_IMAGE --docker-metadata-file $METADATA_FILE
extends: .ci-image

########################################################################################################################
# Tests
Expand Down Expand Up @@ -286,7 +263,7 @@ rum-fit-tests:
allow_failure: true
interruptible: true
inherit:
# Keep SDK CI settings, especially CURRENT_CI_IMAGE, out of FIT.
# Keep SDK CI settings, especially CI_IMAGE, out of FIT.
variables: false
trigger:
project: DataDog/rum-sdk-integration-test-framework
Expand Down Expand Up @@ -345,7 +322,7 @@ check-js-core-api:

unit-bs:
stage: browserstack
needs: ['unit']
needs: ['ci-image', 'unit']
extends:
- .base-configuration
- .bs-allowed-branches
Expand Down Expand Up @@ -449,7 +426,9 @@ deploy-auto:
# Notify
########################################################################################################################

include: 'https://gitlab-templates.ddbuild.io/slack-notifier/v3-sdm/template.yml'
include:
- local: .gitlab/ci-image.yml
- 'https://gitlab-templates.ddbuild.io/slack-notifier/v3-sdm/template.yml'

notify-feature-branch-failure:
extends:
Expand Down
45 changes: 45 additions & 0 deletions .gitlab/ci-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# CI image used by every job (`image: $CI_IMAGE`).
#
# The image tag is a hash of the image inputs: the Dockerfile, this file, CHROME_PACKAGE_VERSION and
# the root @playwright/test version. The job builds and signs the image only when no image has this
# tag yet, then gives CI_IMAGE to the jobs of the next stages through a dotenv report. A job that
# uses `needs:` must list `ci-image` in it to get CI_IMAGE.
#
# To rebuild the image without changing its inputs (e.g. to get a newer commit-headless), change a
# comment in the Dockerfile.
.ci-image:
stage: ci-image
tags:
- 'arch:amd64'
image: $BUILD_STABLE_REGISTRY/images/docker:27.3.1
interruptible: true
id_tokens:
DDSIGN_ID_TOKEN:
aud: image-integrity
retry:
max: 2
when:
- runner_system_failure
script:
- PLAYWRIGHT_VERSION=$(jq -r '.devDependencies["@playwright/test"]' package.json)
- CI_IMAGE_TAG=$({ cat Dockerfile .gitlab/ci-image.yml; echo "$CHROME_PACKAGE_VERSION"; echo "$PLAYWRIGHT_VERSION"; } | sha256sum | cut -c1-16)
- CI_IMAGE="$BUILD_STABLE_REGISTRY/ci/$APP:$CI_IMAGE_TAG"
- |
if docker buildx imagetools inspect "$CI_IMAGE" > /dev/null 2>&1; then
echo "$CI_IMAGE already exists, skipping the build"
else
METADATA_FILE=$(mktemp)
docker buildx build \
--platform linux/amd64 \
--build-arg CHROME_PACKAGE_VERSION="$CHROME_PACKAGE_VERSION" \
--build-arg PLAYWRIGHT_VERSION="$PLAYWRIGHT_VERSION" \
--tag "$CI_IMAGE" \
--push \
--metadata-file "$METADATA_FILE" \
.
ddsign sign "$CI_IMAGE" --docker-metadata-file "$METADATA_FILE"
fi
- echo "CI_IMAGE=$CI_IMAGE" > ci-image.env
artifacts:
reports:
dotenv: ci-image.env
16 changes: 15 additions & 1 deletion .gitlab/deploy-auto.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
stages:
- ci-image
- pre-notify
- deploy
- post-notify

# Recomputes CI_IMAGE (the parent pipeline already built the image): see .gitlab/ci-image.yml
ci-image:
extends: .ci-image

.base-configuration:
tags:
- 'arch:amd64'
Expand Down Expand Up @@ -35,6 +40,7 @@ step-1_deploy-prod-minor-dcs:

step-2_deploy-prod-private-regions:
needs:
- ci-image
- step-1_deploy-prod-minor-dcs
extends:
- .base-configuration
Expand All @@ -44,6 +50,7 @@ step-2_deploy-prod-private-regions:

step-3_deploy-prod-eu1:
needs:
- ci-image
- step-2_deploy-prod-private-regions
extends:
- .base-configuration
Expand All @@ -53,6 +60,7 @@ step-3_deploy-prod-eu1:

step-4_deploy-prod-us1:
needs:
- ci-image
- step-3_deploy-prod-eu1
extends:
- .base-configuration
Expand All @@ -62,6 +70,7 @@ step-4_deploy-prod-us1:

step-5_deploy-prod-gov:
needs:
- ci-image
- step-4_deploy-prod-us1
extends:
- .base-configuration
Expand All @@ -71,6 +80,7 @@ step-5_deploy-prod-gov:

step-6_publish-npm:
needs:
- ci-image
- step-5_deploy-prod-gov
stage: deploy
extends:
Expand All @@ -83,6 +93,7 @@ step-6_publish-npm:

step-7_publish-developer-extension:
needs:
- ci-image
- step-6_publish-npm
stage: deploy
extends:
Expand All @@ -94,6 +105,7 @@ step-7_publish-developer-extension:

step-8_publish-github-release:
needs:
- ci-image
- step-7_publish-developer-extension
stage: deploy
extends:
Expand All @@ -107,7 +119,9 @@ step-8_publish-github-release:
# Notify
########################################################################################################################

include: 'https://gitlab-templates.ddbuild.io/slack-notifier/v3-sdm/template.yml'
include:
- local: .gitlab/ci-image.yml
- 'https://gitlab-templates.ddbuild.io/slack-notifier/v3-sdm/template.yml'

.prepare_notification:
extends: .slack-notifier-base
Expand Down
9 changes: 8 additions & 1 deletion .gitlab/deploy-manual.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
stages:
- ci-image
- pre-notify
- deploy
- post-notify

# Recomputes CI_IMAGE (the parent pipeline already built the image): see .gitlab/ci-image.yml
ci-image:
extends: .ci-image

.base-configuration:
tags:
- 'arch:amd64'
Expand Down Expand Up @@ -103,7 +108,9 @@ optional_step-deploy-to-new-datacenter:
# Notify
########################################################################################################################

include: 'https://gitlab-templates.ddbuild.io/slack-notifier/v3-sdm/template.yml'
include:
- local: .gitlab/ci-image.yml
- 'https://gitlab-templates.ddbuild.io/slack-notifier/v3-sdm/template.yml'

.prepare_notification:
extends: .slack-notifier-base
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"matchUpdateTypes": ["minor", "patch"]
},
{
"description": "Node.js and Playwright need a CI image rebuild, so they need a manual review: keep them out of the auto-approved all-minor-patch batch",
"description": "Node.js and Playwright change the CI image, so they need a manual review: keep them out of the auto-approved all-minor-patch batch",
"matchDepNames": ["node", "@playwright/test"],
"matchUpdateTypes": ["minor", "patch"],
"groupName": "dependencies that need a manual review",
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-node-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runMain(async () => {
printError('Different node versions detected!\n')
printError('Ensure to:')
printError(`- run \`volta pin node@${dockerVersion}\``)
printError('- bump `CURRENT_CI_IMAGE` and run `ci-image` gitlab job\n')
printError('- check that the `ci-image` gitlab job built the image of this commit\n')
process.exit(1)
}
})
Expand Down
6 changes: 2 additions & 4 deletions scripts/test/bump-chrome-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { initGitConfig, createPullRequest, pushSignedCommit } from '../lib/gitUt

const REPOSITORY = process.env.GIT_REPOSITORY
const MAIN_BRANCH = process.env.MAIN_BRANCH
const CURRENT_CI_IMAGE = process.env.CURRENT_CI_IMAGE
const CURRENT_PACKAGE_VERSION = process.env.CHROME_PACKAGE_VERSION

const CHROME_PACKAGE_URL = 'https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable'

runMain(async () => {
if (!REPOSITORY || !MAIN_BRANCH || !CURRENT_CI_IMAGE || !CURRENT_PACKAGE_VERSION) {
if (!REPOSITORY || !MAIN_BRANCH || !CURRENT_PACKAGE_VERSION) {
throw new Error('Missing required environment variables')
}

Expand Down Expand Up @@ -45,9 +44,8 @@ runMain(async () => {

command`git checkout -b ${chromeVersionBranch}`.run()

printLog('Update versions...')
printLog('Update version...')
await replaceCiFileVariable('CHROME_PACKAGE_VERSION', packageVersion)
await replaceCiFileVariable('CURRENT_CI_IMAGE', String(Number(CURRENT_CI_IMAGE) + 1))

command`git add ${CI_FILE}`.run()
command`git commit -m ${commitMessage}`.run()
Expand Down
Loading