data-platform team mailing list archive
-
data-platform team
-
Mailing list archive
-
Message #00227
[Merge] soss/+source/charmed-kafka:dpe-xxx-3.6.2-ubuntu0 into soss/+source/charmed-kafka:lp-3.6.2
Enrico Deusebio has proposed merging soss/+source/charmed-kafka:dpe-xxx-3.6.2-ubuntu0 into soss/+source/charmed-kafka:lp-3.6.2.
Requested reviews:
Canonical Data Platform (data-platform)
For more details, see:
https://code.launchpad.net/~data-platform/soss/+source/charmed-kafka/+git/charmed-kafka/+merge/468235
--
Your team Canonical Data Platform is requested to review the proposed merge of soss/+source/charmed-kafka:dpe-xxx-3.6.2-ubuntu0 into soss/+source/charmed-kafka:lp-3.6.2.
diff --git a/.launchpad.yaml b/.launchpad.yaml
new file mode 100644
index 0000000..a08b665
--- /dev/null
+++ b/.launchpad.yaml
@@ -0,0 +1,260 @@
+pipeline:
+ - prepare
+ - build
+ - tests
+ - release
+
+jobs:
+ prepare:
+ series: jammy
+ architectures: amd64
+ environment:
+ BASE_BUILD_DIR: /home/kafka/kafka-build
+ ARTIFACTORY_BUILDING_URL: "https://canonical.jfrog.io/artifactory/dataplatform-kafka/"
+ ARTIFACTORY_STAGING_URL: "https://canonical.jfrog.io/artifactory/dataplatform-kafka-staging/"
+ packages:
+ - git
+ run: |-
+ echo -e "##################################"
+ echo -e "PREPARE"
+ echo -e "##################################"
+
+ # try to read branch name (works only locally)
+ BRANCH_NAME=$(git branch --show-current)
+ COMMIT_ID=$(git rev-parse HEAD)
+
+ # check if branch name is valid
+ if [ -z "$BRANCH_NAME" ]
+ then
+ # get branch revision id from git HEAD file
+ echo "No branch name given from git command! Try to get it from .git folder"
+ git_rev=$(cat .git/HEAD)
+ while read line; do
+ current_rev=$( echo $line | awk -F ' ' '{print $1}' )
+ branch_name=$( echo $line | awk -F ' ' '{print $2}' | awk -F '/' '{print $NF}' )
+ if [[ $current_rev = $git_rev ]]
+ then
+ export BRANCH_NAME=$branch_name
+ fi
+ done < .git/packed-refs
+ fi
+
+ # create kafka-build
+ mkdir -p ${BASE_BUILD_DIR}
+
+ # move current project to the home dir
+ cp -r * "${BASE_BUILD_DIR}/."
+
+ cd ${BASE_BUILD_DIR}
+
+ # create release name
+ BUILD_VERSION=$(date '+%Y%m%d%H%M%S')
+ KAFKA_VERSION=$(cat gradle.properties | grep version\= | cut -d "=" -f2)
+ if [ ! -f "./lp/PATCH_VERSION" ];
+ then
+ CANONICAL_PATCH_VERSION="ubuntu0"
+ else
+ CANONICAL_PATCH_VERSION=$(cat ./lp/PATCH_VERSION)
+ fi
+ VERSION="$KAFKA_VERSION-$CANONICAL_PATCH_VERSION"
+
+ [ ! -z "$BRANCH_NAME" ] && echo "Current branch: $BRANCH_NAME"
+ if [ -z "$RELEASE" ]; then
+ if [[ "$BRANCH_NAME" != "lp-"* ]]; then
+ RELEASE=false
+ else
+ RELEASE=true
+ fi
+ fi
+
+ mkdir -p logs
+ METADATA_FILE=${BASE_BUILD_DIR}/logs/metadata.yaml
+ echo -e "version: $VERSION\nrelease: $RELEASE\nbranch: $BRANCH_NAME\ncommit_id: $COMMIT_ID\nbuild: $BUILD_VERSION" > $METADATA_FILE
+
+ echo "********"
+ echo "Metadata"
+ echo "********"
+ cat $METADATA_FILE
+
+ # copy gradle repo conf
+ mkdir -p ~/.gradle; cp ./lp/init.gradle ~/.gradle
+
+ CREDENTIALS_FILE="credentials.yaml"
+
+ if [[ "$RELEASE" = "true" ]]; then
+ export ARTIFACTORY_URL="${ARTIFACTORY_BUILDING_URL}"
+ else
+ export ARTIFACTORY_URL="${ARTIFACTORY_STAGING_URL}"
+ fi
+
+ echo "Selected artifactory: $ARTIFACTORY_URL"
+ echo "Release artifact: $RELEASE"
+
+ # check artifactory credentials
+ [ -z "PIP_INDEX_URL" ] && exit 1
+ [ ! -z "$PIP_INDEX_URL" ] && echo "Env variable exists :) "
+ [ ! -z "$PIP_INDEX_URL" ] && export ARTIFACTORY_USER=$(echo "${PIP_INDEX_URL#https://}" | awk -F '@' '{print $1}' | awk -F ':' '{print $1}')
+ [ ! -z "$PIP_INDEX_URL" ] && export ARTIFACTORY_PASSWORD=$(echo "${PIP_INDEX_URL#https://}" | awk -F '@' '{print $1}' | awk -F ':' '{print $2}')
+
+ echo -e "url: ${ARTIFACTORY_URL}\nuser: ${ARTIFACTORY_USER}\npassword: ${ARTIFACTORY_PASSWORD}" > $CREDENTIALS_FILE
+
+ build:
+ series: jammy
+ architectures: amd64
+ environment:
+ BASE_BUILD_DIR: /home/kafka/kafka-build
+ HTTPS_PROXY: 10.10.10.1:8222
+ HTTP_PROXY: 10.10.10.1:8222
+ JAVA_OPTS: "-Dhttp.proxyHost=10.10.10.1 -Dhttp.proxyPort=8222 -Dhttps.proxyHost=10.10.10.1 -Dhttps.proxyPort=8222 -Dhttp.nonProxyHosts=localhost"
+ NO_PROXY: localhost
+ packages:
+ - build-essential
+ - wget
+ - openjdk-18-jdk-headless
+ - tcpdump
+ snaps:
+ - name: yq
+ classic: true
+ run: |-
+ echo -e "##################################"
+ echo -e "BUILD"
+ echo -e "##################################"
+
+ METADATA_FILE=${BASE_BUILD_DIR}/logs/metadata.yaml
+ CREDENTIALS_FILE=${BASE_BUILD_DIR}/credentials.yaml
+
+ VERSION=$(cat $METADATA_FILE | yq .version)
+ RELEASE=$(cat $METADATA_FILE | yq .release)
+ BRANCH=$(cat $METADATA_FILE | yq .branch)
+ COMMIT_ID=$(cat $METADATA_FILE | yq .commit_id)
+
+ export ARTIFACTORY_URL=$(cat $CREDENTIALS_FILE | yq .url)
+ export ARTIFACTORY_USER=$(cat $CREDENTIALS_FILE | yq .user)
+ export ARTIFACTORY_PASSWORD=$(cat $CREDENTIALS_FILE | yq .password)
+
+ echo "ARTIFACTORY USERNAME: ${ARTIFACTORY_USER}"
+
+ export GRADLE_OPTS="-Dgradle.wrapperUser=${ARTIFACTORY_USER} -Dgradle.wrapperPassword=${ARTIFACTORY_PASSWORD}"
+
+ if [ -n "$MODE" ] && [ "$MODE" = "dev" ];
+ then
+ export JAVA_OPTS=""
+ tcpdump -U -i any -w ${BASE_BUILD_DIR}/logs/dump.pcap &
+ sleep 5
+ TCPDUMP_PID=$(ps -e | pgrep tcpdump)
+ echo "TCPDUMP RUNNING AT: ${TCPDUMP_PID}"
+ fi
+
+ mkdir -p ~/.m2/repository
+
+ EXTRA_ARGS="-Pversion=${VERSION} -PcommitId=${COMMIT_ID} -PskipSigning=true -PmavenUrl=file:///root/.m2/repository releaseTarGz publishToMavenLocal"
+
+ export _JAVA_OPTIONS=$JAVA_OPTS
+ pushd ${BASE_BUILD_DIR} && ./gradlew $EXTRA_ARGS && popd
+
+ mv ~/.m2 ${BASE_BUILD_DIR}/.
+
+ if [ -n "$TCPDUMP_PID" ];
+ then
+ sleep 5
+ echo "Killing tcpdump process: ${TCPDUMP_PID}"
+ kill -9 "${TCPDUMP_PID}"
+ fi
+
+ tests:
+ series: jammy
+ architectures: amd64
+ environment:
+ BASE_BUILD_DIR: /home/kafka/kafka-build
+ HTTPS_PROXY: 10.10.10.1:8222
+ HTTP_PROXY: 10.10.10.1:8222
+ JAVA_OPTS: "-Dhttp.proxyHost=10.10.10.1 -Dhttp.proxyPort=8222 -Dhttps.proxyHost=10.10.10.1 -Dhttps.proxyPort=8222 -Dhttp.nonProxyHosts=localhost"
+ NO_PROXY: localhost
+ packages:
+ - build-essential
+ - wget
+ - openjdk-18-jdk-headless
+ snaps:
+ - name: yq
+ classic: true
+ run: |-
+ echo -e "##################################"
+ echo -e "TESTS"
+ echo -e "##################################"
+
+ METADATA_FILE=${BASE_BUILD_DIR}/logs/metadata.yaml
+ CREDENTIALS_FILE=${BASE_BUILD_DIR}/credentials.yaml
+
+ VERSION=$(cat $METADATA_FILE | yq .version)
+ RELEASE=$(cat $METADATA_FILE | yq .release)
+ BRANCH=$(cat $METADATA_FILE | yq .branch)
+ COMMIT_ID=$(cat $METADATA_FILE | yq .commit_id)
+
+ export ARTIFACTORY_URL=$(cat $CREDENTIALS_FILE | yq .url)
+ export ARTIFACTORY_USER=$(cat $CREDENTIALS_FILE | yq .user)
+ export ARTIFACTORY_PASSWORD=$(cat $CREDENTIALS_FILE | yq .password)
+
+ echo "ARTIFACTORY USERNAME: ${ARTIFACTORY_USER}"
+
+ export GRADLE_OPTS="-Dgradle.wrapperUser=${ARTIFACTORY_USER} -Dgradle.wrapperPassword=${ARTIFACTORY_PASSWORD}"
+
+ if [ -n "$MODE" ] && [ "$MODE" = "dev" ];
+ then
+ export JAVA_OPTS=""
+ fi
+
+ EXTRA_ARGS="-Pversion=${VERSION} -PcommitId=${COMMIT_ID} test"
+
+ export _JAVA_OPTIONS=$JAVA_OPTS
+ # OUTCOME=$( (pushd ${BASE_BUILD_DIR} && ./gradlew $EXTRA_ARGS && popd | echo "success") || echo "failed" )
+
+ echo "Tests outcome: $OUTCOME"
+
+ release:
+ series: jammy
+ architectures: amd64
+ environment:
+ BASE_BUILD_DIR: /home/kafka/kafka-build
+ packages:
+ - zip
+ run: |-
+ echo -e "##################################"
+ echo -e "PACKAGE RELEASE ARTIFACTS"
+ echo -e "##################################"
+
+ METADATA_FILE=${BASE_BUILD_DIR}/logs/metadata.yaml
+
+ VERSION=$(cat $METADATA_FILE | yq .version)
+ BUILD_VERSION=$(cat $METADATA_FILE | yq .build)
+
+ # copy the tarball to the launchpad build directory
+ cp ${BASE_BUILD_DIR}/core/build/distributions/*${VERSION}.tgz ./
+
+ # compute the checksum
+ FILE=$(find . -maxdepth 1 -regex "./kafka_[0-9\.-]+\-${VERSION}.tgz" | tail -n1 )
+ TARBALL="${FILE%.*}-${BUILD_VERSION}.${FILE##*.}"
+ mv $FILE $TARBALL
+
+ echo "Distribution: ${TARBALL}"
+ sha512sum "${TARBALL}" > "${TARBALL}.sha512"
+
+ PROJECT_ROOT="${PWD}"
+
+ # .m2 repos
+ pushd $BASE_BUILD_DIR/.m2
+ zip -r repository.zip repository
+ mv repository.zip ${PROJECT_ROOT}/.
+ popd
+
+ # Logs
+ pushd $BASE_BUILD_DIR
+ zip -r logs.zip logs
+ mv logs.zip ${PROJECT_ROOT}/logs_$VERSION.zip
+ popd
+
+ output:
+ paths:
+ - kafka_*.tgz
+ - kafka_*.tgz.sha512
+ - repository.zip
+ - logs_*.zip
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 408ab48..a127ca1 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=7c3ad722e9b0ce8205b91560fd6ce8296ac3eadf065672242fd73c06b8eeb6ee
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
+distributionUrl=https\://canonical.jfrog.io/artifactory/dataplatform-generic-stable-local/gradle/gradle-8.2.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/lp/PATCH_VERSION b/lp/PATCH_VERSION
new file mode 100644
index 0000000..faee25c
--- /dev/null
+++ b/lp/PATCH_VERSION
@@ -0,0 +1 @@
+ubuntu0
\ No newline at end of file
diff --git a/lp/init.gradle b/lp/init.gradle
new file mode 100644
index 0000000..a2f6f8e
--- /dev/null
+++ b/lp/init.gradle
@@ -0,0 +1,59 @@
+apply plugin: EnterpriseRepositoryPlugin
+
+class EnterpriseRepositoryPlugin implements Plugin<Gradle> {
+
+ void apply(Gradle gradle) {
+
+ String ENTERPRISE_REPOSITORY_URL = "$System.env.ARTIFACTORY_URL"
+
+ // ONLY USE ENTERPRISE REPO FOR DEPENDENCIES
+ gradle.settingsEvaluated { settings ->
+ settings.pluginManagement.repositories {
+ // Remove all repositories not pointing to the canonical JFrog repository url
+ all {
+ ArtifactRepository repo ->
+ if (repo.url.toString() != ENTERPRISE_REPOSITORY_URL) {
+ // settings.logger.lifecycle "Repository ${repo.url} removed. Only $ENTERPRISE_REPOSITORY_URL is allowed"
+ remove repo
+ }
+ }
+
+ // add the canonical JFrog repository
+ maven {
+ name "Canonical JFrog"
+ url "$System.env.ARTIFACTORY_URL"
+ credentials {
+ username "$System.env.ARTIFACTORY_USER"
+ password "$System.env.ARTIFACTORY_PASSWORD"
+ }
+ }
+ }
+ }
+
+ gradle.allprojects { project ->
+ project.repositories {
+
+ // Remove all repositories not pointing to the canonical JFrog repository url
+ all {
+ ArtifactRepository repo ->
+ if (repo instanceof UrlArtifactRepository && repo.url.toString() != ENTERPRISE_REPOSITORY_URL) {
+ // project.logger.lifecycle "Repository ${repo.url} removed. Only $ENTERPRISE_REPOSITORY_URL is allowed"
+ remove repo
+ }
+ }
+
+ // add the canonical JFrog repository
+ maven {
+ name "Canonical JFrog"
+ url "$System.env.ARTIFACTORY_URL"
+ credentials {
+ username "$System.env.ARTIFACTORY_USER"
+ password "$System.env.ARTIFACTORY_PASSWORD"
+ }
+ }
+
+ }
+
+ }
+ }
+}
\ No newline at end of file