Skip to content

Commit c13cf84

Browse files
Merge pull request #2731 from DataDog/aleksandr-gringauz/RUM-10224/github-app-migration-for-pat-synthetics
RUM-10224: Introduce check release pipeline
2 parents db25ca2 + 0a5ebef commit c13cf84

11 files changed

+1114
-1033
lines changed

.gitlab-ci.yml

Lines changed: 9 additions & 1033 deletions
Large diffs are not rendered by default.

build.gradle.kts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,21 @@ tasks.register("printSdkDebugRuntimeClasspath") {
224224
File("sdk_classpath").writeText(result.joinToString(File.pathSeparator) { it.absolutePath })
225225
}
226226
}
227+
228+
tasks.register("listAllPublishedArtifactIds") {
229+
doLast {
230+
val artifactIds = rootProject.subprojects.flatMap { subproject ->
231+
val publishing = subproject.extensions.findByType<PublishingExtension>()
232+
publishing?.publications?.mapNotNull { publication ->
233+
if (publication is MavenPublication) {
234+
publication.artifactId
235+
} else {
236+
null
237+
}
238+
}.orEmpty()
239+
}
240+
artifactIds.forEach {
241+
println(it)
242+
}
243+
}
244+
}
File renamed without changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include:
2+
- "ci/pipelines/common-snippets.yml"
3+
- 'https://gitlab-templates.ddbuild.io/slack-notifier/v1/template.yml'
4+
5+
stages:
6+
- check-release
7+
- notify
8+
9+
check-release:is-published:
10+
tags: [ "arch:amd64" ]
11+
image: $CI_IMAGE_DOCKER
12+
stage: check-release
13+
script:
14+
- !reference [ .common-snippets, set-github-installation-token ]
15+
- bash ./ci/scripts/check_latest_release_is_published.sh
16+
17+
notify:report-failure-to-slack:
18+
extends: .slack-notifier-base
19+
stage: notify
20+
when: on_failure
21+
script:
22+
- BUILD_URL="$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID"
23+
- 'MESSAGE_TEXT=":status_alert: Some release artifacts were not published to maven. $BUILD_URL"'
24+
- postmessage "#mobile-sdk-ops" "$MESSAGE_TEXT"

ci/pipelines/common-snippets.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.common-snippets:
2+
set-github-installation-token:
3+
- export GITHUB_APP_CLIENT_ID=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gh_app_client_id --with-decryption --query "Parameter.Value" --out text)
4+
- export GITHUB_APP_INSTALLATION_ID=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gh_app_installation_id --with-decryption --query "Parameter.Value" --out text)
5+
- export GITHUB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gh_app_private_key --with-decryption --query "Parameter.Value" --out text | bash ./ci/scripts/create_github_installation_token.sh "$GITHUB_APP_CLIENT_ID" "$GITHUB_APP_INSTALLATION_ID")

ci/pipelines/default-pipeline.yml

Lines changed: 1030 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
4+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
5+
# Copyright 2016-Present Datadog, Inc.
6+
#
7+
8+
set -o pipefail
9+
10+
tag_name=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
11+
-H "Accept: application/vnd.github+json" \
12+
https://api.github.com/repos/DataDog/dd-sdk-android/releases/latest | jq -r .tag_name)
13+
14+
for artifactId in $(./gradlew -q listAllPublishedArtifactIds); do
15+
status_code=$(curl -s -o /dev/null -w "%{http_code}" "https://repo1.maven.org/maven2/com/datadoghq/$artifactId/$tag_name/$artifactId-$tag_name.aar")
16+
17+
if [ $status_code -eq 200 ]; then
18+
echo "Release $tag_name exists for $artifactId"
19+
else
20+
echo "Release $tag_name doesn't exist for $artifactId"
21+
# TODO remove this check when
22+
# https://github.com/DataDog/dd-sdk-android/commit/ccd79322895a6ba135e2b73b32005fb4aeb5c31c
23+
# is released
24+
if [ $artifactId != "dd-sdk-android-benchmark-internal" ]; then
25+
exit 1
26+
fi
27+
fi
28+
done
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)