diff --git a/.jenkins/jenkins_pod.yml b/.jenkins/jenkins_pod.yml index 7fccded0ef4b8..ae5cbe340a0b1 100644 --- a/.jenkins/jenkins_pod.yml +++ b/.jenkins/jenkins_pod.yml @@ -28,6 +28,9 @@ spec: command: [ cat ] tty: true volumeMounts: [ + # writable ~/.m2 so settings.xml can be copied for the Trivy scan + { name: jenkins-m2-temp, + mountPath: /home/jenkins/.m2 }, { name: efs-jenkins-component-runtime-m2-rootless, mountPath: /home/jenkins/.m2/repository }, { name: efs-jenkins-connectors-asdf-rootless, @@ -46,6 +49,8 @@ spec: periodSeconds: 5 ## volumes: # Persistent volumes stored under Amazon Elastic File System (efs) defined in flux + - name: jenkins-m2-temp + emptyDir: {} - name: efs-jenkins-component-runtime-m2-rootless persistentVolumeClaim: claimName: efs-jenkins-component-runtime-m2-rootless diff --git a/.jenkins/scripts/docker_build.sh b/.jenkins/scripts/docker_build.sh index d6d558cc60d55..65b71f32ddb5b 100755 --- a/.jenkins/scripts/docker_build.sh +++ b/.jenkins/scripts/docker_build.sh @@ -50,12 +50,14 @@ dockerBuild() { mvn package "${_JIB_GOAL}" \ --file "images/${_IMAGE}-image/pom.xml" \ --define docker.talend.image.tag="${_TAG}" \ + --settings .jenkins/settings.xml \ $skip_for_docker_build if [[ ${_IS_LATEST} == 'true' ]]; then mvn package "${_JIB_GOAL}" \ --file "images/${_IMAGE}-image/pom.xml" \ --define docker.talend.image.tag=latest \ + --settings .jenkins/settings.xml \ $skip_for_docker_build fi } diff --git a/.jenkins/scripts/release/release-2-prepare.sh b/.jenkins/scripts/release/release-2-prepare.sh index 7b865f111f00b..cafcd5af589f6 100644 --- a/.jenkins/scripts/release/release-2-prepare.sh +++ b/.jenkins/scripts/release/release-2-prepare.sh @@ -40,7 +40,31 @@ main() { printf ">> Maven prepare release %s (next-dev: %s; tag: %s)\n" "${releaseVersion}" "${nextVersion}" "${tagName}" - local release_profiles="release,ossrh,gpg2" + # The documentation module generates tracked files (antora.yml, package-lock.json) + # from the project version. Build and commit them now, otherwise the tag keeps stale values and + # tags with the same antora version make the documentation site build fail (duplicate nav). + # The phase is process-sources on purpose: it is enough for antora.yml. The generated_*.adoc files + # need the compile and process-classes phases and are only regenerated by release-5. They are + # not in the tag. Only the version links in generated_sample-index.adoc can be old on a + # maintenance branch. + printf ">> Regenerate documentation files before tagging\n" + # The antora version is the SNAPSHOT version without suffix, which is the release version. + mvn clean process-sources --batch-mode \ + --projects documentation \ + --define skipTests \ + --define invoker.skip=true \ + --define checkstyle.skip \ + --define enforcer.skip=true \ + --define rat.skip \ + --settings .jenkins/settings.xml \ + "${extraBuildParams[@]}" + + if ! grep -qE "^version: '${releaseVersion%%-*}'$" documentation/src/main/antora/antora.yml; then + printf "WARN: antora.yml version is not %s\n" "${releaseVersion%%-*}" >&2 + fi + git commit -a -m "[jenkins-release] update generated documentation for ${releaseVersion}" || true + + local release_profiles="release,gpg-keyring,gpg2" mvn release:prepare \ --batch-mode \ diff --git a/.jenkins/scripts/release/release-3-perform.sh b/.jenkins/scripts/release/release-3-perform.sh index 0cb6e9b13fe1c..b866c17e3f4af 100644 --- a/.jenkins/scripts/release/release-3-perform.sh +++ b/.jenkins/scripts/release/release-3-perform.sh @@ -24,8 +24,9 @@ main() { printf ">> Maven perform release" - local release_profiles="release,ossrh,gpg2" + local release_profiles="release,gpg-keyring,gpg2" + # Release artifacts are published on the packages of this repository (QTDI-3791), see the release profile. mvn release:perform \ --batch-mode \ --errors \ @@ -33,7 +34,6 @@ main() { --settings .jenkins/settings.xml \ --activate-profiles "$release_profiles" \ "${extraBuildParams[@]}" - } main "$@" diff --git a/.jenkins/scripts/release/release-3.1-perform-studio.sh b/.jenkins/scripts/release/release-3.1-perform-studio.sh deleted file mode 100644 index da5bdbeada733..0000000000000 --- a/.jenkins/scripts/release/release-3.1-perform-studio.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (C) 2006-2026 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set -xe - -# Parameters: -# $1: release version -# $2: next version -# $3: extra build args for all mvn cmd -main() { - local releaseVersion="${1?Missing release version}"; shift - local nextVersion="${1?Missing actual project version}"; shift - local extraBuildParams=("$@") - - printf ">> Maven perform release" - - # todo: add gpg2 profile for signing artifacts - local release_profiles="release-zl" - - # set the release version in the pom.xml - mvn versions:set -DnewVersion="${releaseVersion}" - - mvn clean deploy \ - --file "component-studio/pom.xml" \ - --define arguments="-DskipTests -DskipITs -Dcheckstyle.skip -Denforcer.skip=true -Drat.skip" \ - --settings .jenkins/settings.xml \ - --activate-profiles ${release_profiles} \ - "${extraBuildParams[@]}" - - mvn versions:set -DnewVersion="${nextVersion}" -} - -main "$@" diff --git a/.jenkins/scripts/release/release-5-prepare-next-iteration.sh b/.jenkins/scripts/release/release-5-prepare-next-iteration.sh index 2efe48206dc83..1850cb3f549c7 100644 --- a/.jenkins/scripts/release/release-5-prepare-next-iteration.sh +++ b/.jenkins/scripts/release/release-5-prepare-next-iteration.sh @@ -42,13 +42,22 @@ main() { git checkout "${branchName}" # "|| true" is here to avoid blocking the jenkins pipeline in case of failure - mvn clean install --define skipTests \ + mvn clean install --settings .jenkins/settings.xml \ + --define skipTests \ --define invoker.skip=true \ --define checkstyle.skip \ --define enforcer.skip=true \ --define rat.skip \ "${extraBuildParams[@]}" || true + # The install above ignores failures, so check that the documentation module regenerated antora.yml. + # A version left identical to the release tag makes the documentation site build fail (duplicate nav). + local devVersion + devVersion="$(grep -m1 -oP '(?<=)[^<]+' pom.xml || true)" + if ! grep -qE "^version: '${devVersion%%-*}'$" documentation/src/main/antora/antora.yml; then + printf "WARN: antora.yml version is not %s, the documentation build was probably skipped; fix it manually\n" "${devVersion%%-*}" >&2 + fi + printf "Push to github\n" # "|| true" is here to avoid blocking the jenkins pipeline when there is nothing to commit git commit -a -m "Updating doc for next iteration" || true diff --git a/.jenkins/scripts/release_legacy.sh b/.jenkins/scripts/release_legacy.sh index 3b2b8359527fb..47df820ab2048 100644 --- a/.jenkins/scripts/release_legacy.sh +++ b/.jenkins/scripts/release_legacy.sh @@ -64,7 +64,7 @@ main() { --define releaseVersion="${release}" \ --define developmentVersion="${dev_version}" \ --define arguments="-DskipTests -DskipITs -Dinvoker.skip=true" \ - --activate-profiles ossrh,release,gpg2 \ + --activate-profiles gpg-keyring,release,gpg2 \ ${extraBuildParams} \ --settings .jenkins/settings.xml echo ">> Maven perform release $release" @@ -72,7 +72,7 @@ main() { --batch-mode \ --errors \ --define arguments="-DskipTests -DskipITs -Dinvoker.skip=true" \ - --activate-profiles ossrh,release,gpg2 \ + --activate-profiles gpg-keyring,release,gpg2 \ ${extraBuildParams} \ --settings .jenkins/settings.xml ### diff --git a/.jenkins/settings.xml b/.jenkins/settings.xml index 90709b505ff1b..33d8ce07fe7d9 100644 --- a/.jenkins/settings.xml +++ b/.jenkins/settings.xml @@ -4,11 +4,6 @@ http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - - central.portal - ${env.OSSRH_USER} - ${env.OSSRH_PASS} - github ${env.GITHUB_LOGIN} @@ -20,60 +15,9 @@ ${env.JIRA_PASS} - TalendOpenSourceRelease - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - 30000 - - - - TalendOpenSourceSnapshot - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - 30000 - - - - talend.oss.snapshots - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - 30000 - - - - talend.oss.releases - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - 30000 - - - - talend.snapshots - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - 30000 - - - - talend.releases - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - 30000 - - - - talend_nexus_deployment - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - 30000 - + github_packages + ${env.GITHUB_PACKAGES_LOGIN} + ${env.GITHUB_PACKAGES_TOKEN} artifactory.datapwn.com @@ -82,18 +26,20 @@ + - maven_central_proxy - Maven Central Proxy - https://artifacts-zl.talend.com/nexus/content/repositories/central/ + artifactory.datapwn.com + Internal Artifactory Maven Central cache + https://artifactory.datapwn.com/artifactory/maven-central-remote central - ossrh + gpg-keyring -Xdoclint:none gpg diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000000000..0e9bb0de13b1a --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,2 @@ +-Daether.connector.connectTimeout=60000 +-Daether.connector.requestTimeout=300000 diff --git a/Jenkinsfile b/Jenkinsfile index 81f0511182c00..e0b0a2021c603 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,13 +18,6 @@ import java.time.LocalDateTime import java.util.regex.Matcher // Credentials -final def ossrhCredentials = usernamePassword( - credentialsId: 'ossrh-credentials', - usernameVariable: 'OSSRH_USER', - passwordVariable: 'OSSRH_PASS') -final def nexusCredentials = usernamePassword( - credentialsId: 'nexus-artifact-zl-credentials', - usernameVariable: 'NEXUS_USER', passwordVariable: 'NEXUS_PASS') final def jiraCredentials = usernamePassword( credentialsId: 'jira-credentials', usernameVariable: 'JIRA_USER', @@ -33,6 +26,10 @@ final def gitCredentials = usernamePassword( credentialsId: 'github-credentials', usernameVariable: 'GITHUB_LOGIN', passwordVariable: 'GITHUB_TOKEN') +final def githubPackagesCredentials = usernamePassword( + credentialsId: 'github-packages-ci-runner-connectors-pat', + usernameVariable: 'GITHUB_PACKAGES_LOGIN', + passwordVariable: 'GITHUB_PACKAGES_TOKEN') final def dockerCredentials = usernamePassword( credentialsId: 'artifactory-datapwn-credentials', usernameVariable: 'DOCKER_USER', @@ -76,8 +73,7 @@ Boolean devBranch_dockerPush = false String skipOptions = "-Dspotless.apply.skip=true -Dcheckstyle.skip=true -Drat.skip=true -DskipTests -Dinvoker.skip=true" -String deployOptions = "$skipOptions -Possrh -Prelease -Pgpg2 -Denforcer.skip=true" -String nexusDeployOptions = "$skipOptions --activate-profiles private_repository -Denforcer.skip=true" +String deployOptions = "$skipOptions -Denforcer.skip=true" pipeline { @@ -148,8 +144,8 @@ pipeline { defaultValue: false, description: ''' Force MAVEN deploy stage for development branches. No effect on master and maintenance. - INFO: master/maintenance branch deploys artefacts on - dev branches deploy artefacts on ''') + INFO: master/maintenance branch deploys artefacts on GitHub Packages + dev branches deploy qualified artefacts on GitHub Packages (component-runtime)''') booleanParam( name: 'DOCKER_PUSH', defaultValue: false, @@ -199,7 +195,7 @@ pipeline { booleanParam( name: 'FORCE_DEPS_REPORT', defaultValue: false, - description: 'Force dependencies report stage for branches.') + description: 'Force the dependencies report stage. The stage is skipped by default.') /////////////////////////////////////////////////////////////////////////////////////////////////////////////// separator(name: "EXPERT_CONFIG", @@ -243,16 +239,8 @@ pipeline { so you can test Jenkins pipeline changes (e.g. the Maven deploy stages) end to end from a dev branch. WARNING: the resulting artifact uses the exact same (unqualified) SNAPSHOT version as master. If this build deploys, it WILL OVERWRITE the artifacts - currently published by the master branch build on both the internal Nexus - and Sonatype/OSSRH repositories. If you do it, be sure that your branch is up to date with master. + currently published by the master branch build on the GitHub Packages repository. If you do it, be sure that your branch is up to date with master. Only to test Jenkins job evolution, never for real development work.''') - booleanParam( - name: 'NO_SONATYPE', - defaultValue: false, - description: ''' - DEBUG ONLY - skips the Sonatype/OSSRH deploy stage entirely, whatever the branch. - Use this to test the pipeline faster when the slow/unreliable Sonatype deploy - is not what you want to validate (e.g. only testing the internal Nexus deploy stage).''') } stages { @@ -295,16 +283,6 @@ pipeline { // NO_QUALIFIER forces the same (unqualified) version as master, see param warning needQualify = (devBranch_mavenDeploy || devBranch_dockerPush) && !params.NO_QUALIFIER - if (needQualify) { - // Qualified version have to be released on talend_repository - // Overwrite the deployOptions - deployOptions = nexusDeployOptions - } - - // hack to overwrite the skip of studio modules that we can't deploy in release mode into Sonatype repo - // assume that we don't use this Jenkinsfile for release anymore - deployOptions = deployOptions.replace("-Prelease", "-Psnapshot") - // By default the doc is skipped for standards branches Boolean skip_documentation = !(params.FORCE_DOC || isStdBranch) extraBuildParams = assemblyExtraBuildParams(skip_documentation) @@ -370,10 +348,12 @@ pipeline { // Maven documentation about maven_version: // https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm println "Edit version on dev branches, new version is ${finalVersion}" - sh """\ + withCredentials([githubPackagesCredentials, dockerCredentials]) { + sh """\ #!/usr/bin/env bash mvn versions:set --define newVersion=${finalVersion} --settings .jenkins/settings.xml """.stripIndent() + } } } @@ -414,7 +394,6 @@ pipeline { steps { withCredentials([gitCredentials, dockerCredentials, - ossrhCredentials, jiraCredentials, gpgCredentials]) { script { @@ -436,8 +415,8 @@ pipeline { stage('Maven validate to install') { when { expression { params.ACTION != 'RELEASE' } } steps { - withCredentials([ossrhCredentials, - nexusCredentials]) { + withCredentials([githubPackagesCredentials, + dockerCredentials]) { sh """\ #!/usr/bin/env bash set -xe @@ -462,73 +441,26 @@ pipeline { } } } - stage('Maven deploy - Nexus') { - // Deploy to internal Nexus first on master/maintenance builds so that - // connectors-se Jenkins agents (which cannot reach central.sonatype.com) - // can resolve SNAPSHOT dependencies as soon as possible, independent of - // whether the Sonatype deploy stage below is slow or times out. + stage('Maven deploy - GitHub Packages') { + // Snapshots and qualified versions go on the component-runtime packages (distributionManagement of the root pom) when { - expression { stdBranch_buildOnly } + anyOf { + expression { stdBranch_buildOnly } + expression { devBranch_mavenDeploy } + } } steps { - withCredentials([nexusCredentials]) { + withCredentials([githubPackagesCredentials, dockerCredentials]) { sh """\ #!/usr/bin/env bash set -xe - mvn deploy ${nexusDeployOptions} \ + mvn deploy ${deployOptions} \ ${extraBuildParams} \ --settings .jenkins/settings.xml """.stripIndent() } - } - } - stage('Maven deploy - Sonatype') { - // Sonatype/OSSRH deploy has a history of being slow/unreliable and can - // otherwise consume the whole pipeline timeout; bound it to its own - // timeout and degrade to UNSTABLE instead of failing the build outright - // (the Nexus deploy stage above already unblocks downstream consumers). - when { - allOf { - expression { !params.NO_SONATYPE } - anyOf { - expression { stdBranch_buildOnly } - expression { devBranch_mavenDeploy } - } - } - } - steps { script { - catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { - timeout(time: 60, unit: 'MINUTES') { - withCredentials([ossrhCredentials, - gpgCredentials, - nexusCredentials]) { - sh """\ - #!/usr/bin/env bash - set -xe - bash mvn deploy $deployOptions \ - $extraBuildParams \ - --settings .jenkins/settings.xml - """.stripIndent() - } - } - } - } - // Add description to job - script { - def repo - String nexusSnapshotUrl = 'https://artifacts-zl.talend.com/nexus/content/repositories/snapshots/org/talend/sdk/component' - if (devBranch_mavenDeploy) { - repo = ['artifacts-zl.talend.com', nexusSnapshotUrl] - } else { - repo = ['oss.sonatype.org', - 'https://central.sonatype.com/repository/maven-snapshots/org/talend/sdk/component/'] - } - - JenkinsStatusController.jobDescriptionAppend("Maven artefact deployed as ${finalVersion} on [${repo[0]}](${repo[1]}) ") - if (stdBranch_buildOnly) { - JenkinsStatusController.jobDescriptionAppend("Maven artefact also deployed as ${finalVersion} on [artifacts-zl.talend.com](${nexusSnapshotUrl}) ") - } + JenkinsStatusController.jobDescriptionAppend("Maven artefact deployed as ${finalVersion} on [GitHub Packages](https://github.com/Talend/component-runtime/packages) ") } } } @@ -541,45 +473,45 @@ pipeline { } steps { script { - configFileProvider([configFile(fileId: 'maven-settings-nexus-zl', variable: 'MAVEN_SETTINGS')]) { - String images_options = '' - if (isStdBranch) { - // Build and push all images - JenkinsStatusController.jobDescriptionAppend("Docker images deployed: component-server, component-starter-server and remote-engine-customizer ") + String images_options = '' + if (isStdBranch) { + // Build and push all images + JenkinsStatusController.jobDescriptionAppend("Docker images deployed: component-server, component-starter-server and remote-engine-customizer ") + } else { + String image_list + if (params.DOCKER_CHOICE == 'All') { + images_options = 'false' } else { - String image_list - if (params.DOCKER_CHOICE == 'All') { - images_options = 'false' - } else { - images_options = 'false ' + params.DOCKER_CHOICE - } + images_options = 'false ' + params.DOCKER_CHOICE + } - if (params.DOCKER_CHOICE == 'All') { - JenkinsStatusController.jobDescriptionAppend("All docker images deployed ") - - JenkinsStatusController.jobDescriptionAppend("As ${finalVersion}${buildTimestamp} on " + - "[artifactory.datapwn.com]" + - "($artifactoryAddr/$artifactoryPath) ") - JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath" + - "/component-server:${finalVersion}${buildTimestamp} ") - JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath" + - "/component-starter-server:${finalVersion}${buildTimestamp} ") - JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath" + - "/remote-engine-customize:${finalVersion}${buildTimestamp} ") - - } else { - JenkinsStatusController.jobDescriptionAppend("Docker images deployed: $params.DOCKER_CHOICE ") - JenkinsStatusController.jobDescriptionAppend("As ${finalVersion}${buildTimestamp} on " + - "[artifactory.datapwn.com]($artifactoryAddr/$artifactoryPath) ") - JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath/$params.DOCKER_CHOICE:" + - "${finalVersion}${buildTimestamp} ") + if (params.DOCKER_CHOICE == 'All') { + JenkinsStatusController.jobDescriptionAppend("All docker images deployed ") - } + JenkinsStatusController.jobDescriptionAppend("As ${finalVersion}${buildTimestamp} on " + + "[artifactory.datapwn.com]" + + "($artifactoryAddr/$artifactoryPath) ") + JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath" + + "/component-server:${finalVersion}${buildTimestamp} ") + JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath" + + "/component-starter-server:${finalVersion}${buildTimestamp} ") + JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath" + + "/remote-engine-customize:${finalVersion}${buildTimestamp} ") + + } else { + JenkinsStatusController.jobDescriptionAppend("Docker images deployed: $params.DOCKER_CHOICE ") + JenkinsStatusController.jobDescriptionAppend("As ${finalVersion}${buildTimestamp} on " + + "[artifactory.datapwn.com]($artifactoryAddr/$artifactoryPath) ") + JenkinsStatusController.jobDescriptionAppend("docker pull $artifactoryAddr/$artifactoryPath/$params.DOCKER_CHOICE:" + + "${finalVersion}${buildTimestamp} ") } - // Build and push specific image + } + + // Build and push specific image + withCredentials([githubPackagesCredentials, dockerCredentials]) { sh """ bash .jenkins/scripts/docker_build.sh \ ${finalVersion}${buildTimestamp} \ @@ -597,7 +529,7 @@ pipeline { } } steps { - withCredentials([ossrhCredentials, gitCredentials]) { + withCredentials([gitCredentials, githubPackagesCredentials, dockerCredentials]) { sh """\ #!/usr/bin/env bash set -xe @@ -613,14 +545,11 @@ pipeline { } stage('Deps report') { when { - anyOf { - expression { params.ACTION != 'RELEASE' && branch_name == 'master' } - expression { params.FORCE_DEPS_REPORT == true } - } + expression { params.FORCE_DEPS_REPORT == true } } steps { - withCredentials([ossrhCredentials, - nexusCredentials]) { + withCredentials([githubPackagesCredentials, + dockerCredentials]) { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { sh """ bash .jenkins/scripts/mvn_dependency_updates_report.sh @@ -657,9 +586,10 @@ pipeline { } steps { script { - withCredentials([nexusCredentials, + withCredentials([githubPackagesCredentials, sonarToken, - gitCredentials]) { + gitCredentials, + dockerCredentials]) { SonarController.runSonar(branch_name, env.CHANGE_TARGET, @@ -680,12 +610,10 @@ pipeline { } steps { script { - withCredentials([gitCredentials, dockerCredentials, ossrhCredentials, jiraCredentials, gpgCredentials, nexusCredentials]) { - configFileProvider([configFile(fileId: 'maven-settings-nexus-zl', variable: 'MAVEN_SETTINGS')]) { - sh """ - bash .jenkins/scripts/release_legacy.sh $branch_name $finalVersion $extraBuildParams - """ - } + withCredentials([gitCredentials, dockerCredentials, jiraCredentials, gpgCredentials, githubPackagesCredentials]) { + sh """ + bash .jenkins/scripts/release_legacy.sh $branch_name $finalVersion $extraBuildParams + """ } } } @@ -695,27 +623,16 @@ pipeline { expression { params.ACTION == 'STANDARD' && params.TRIVY_SCAN == true } } steps { - withCredentials([dockerCredentials]) { - // Trivy reads $HOME/.m2/settings.xml to resolve Maven dependencies: use the mirror instead of Maven Central (429). - // /home/jenkins/.m2 is not writable (only .m2/repository is mounted), so Trivy gets a private HOME outside the scanned workspace. - sh """\ - mkdir -p /tmp/trivy-home/.m2 - # keep everything else of the real HOME (asdf, bashenv, caches...) visible, only .m2 differs - for entry in /home/jenkins/.[!.]* /home/jenkins/*; do - name=\$(basename "\$entry") - [ "\$name" = ".m2" ] || ln -sfn "\$entry" "/tmp/trivy-home/\$name" - done - cp .jenkins/settings.xml /tmp/trivy-home/.m2/settings.xml - ln -sfn /home/jenkins/.m2/repository /tmp/trivy-home/.m2/repository - """.stripIndent() - withEnv(["HOME=/tmp/trivy-home"]) { - script { - trivyTools.generateTrivyReport('output/trivy-results.json', - 'output/trivy-results.html') - } - } - } script { + withCredentials([dockerCredentials, githubPackagesCredentials]) { + // Trivy's pom resolver ignores MAVEN_ARGS/-s and only reads ~/.m2/settings.xml (Artifactory mirror, credentials from the env) + sh ''' + mkdir -p "${HOME}/.m2" + cp "${WORKSPACE}/.jenkins/settings.xml" "${HOME}/.m2/settings.xml" + ''' + trivyTools.generateTrivyReport('output/trivy-results.json', + 'output/trivy-results.html') + } publishHtmlReportTools.publishHtmlReport('output/trivy-results.html', 'CVE Trivy Vulnerability Report') } diff --git a/ci/Jenkinsfile-release b/ci/Jenkinsfile-release index 1115fbb1f3f7e..d64708b125c9c 100644 --- a/ci/Jenkinsfile-release +++ b/ci/Jenkinsfile-release @@ -15,14 +15,10 @@ */ // Credentials -final def ossrhCredentials = usernamePassword( - credentialsId: 'ossrh-credentials', - usernameVariable: 'OSSRH_USER', - passwordVariable: 'OSSRH_PASS') -final def nexusCredentials = usernamePassword( - credentialsId: 'nexus-artifact-zl-credentials', - usernameVariable: 'NEXUS_USER', - passwordVariable: 'NEXUS_PASS') +final def githubPackagesCredentials = usernamePassword( + credentialsId: 'github-packages-ci-runner-connectors-pat', + usernameVariable: 'GITHUB_PACKAGES_LOGIN', + passwordVariable: 'GITHUB_PACKAGES_TOKEN') final def jiraCredentials = usernamePassword( credentialsId: 'jira-credentials', usernameVariable: 'JIRA_USER', @@ -141,18 +137,11 @@ pipeline { sectionHeaderStyle: """ background-color: #A9A9A9; text-align: center; font-size: 35px !important; font-weight : bold; """) /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - booleanParam( - name: 'RELEASE_STUDIO_MODULES', - defaultValue: true, - description: '''Activate release of studio modules. - EXPERT USER ONLY: to solve specials case eg: release ok but it fails for the Studio modules. - ''') booleanParam( name: 'NO_STAGING', defaultValue: false, description: '''Activate the no-staging profile. - Execute the release, but at the end of the release:perform step, - the artifacts are not publish on the NEXUS. + Execute the release, but the artifacts are not published on the GitHub Packages (maven.deploy.skip). EXPERT USER ONLY: to solve specials case eg: release ok but failure during docker publish. ''') booleanParam( @@ -175,7 +164,7 @@ pipeline { CONSEQUENCES: - `release:prepare` runs with `-DdryRun=true`: poms are rewritten and validated locally only. - Nothing is committed, tagged or pushed to git (real repo or fork). - - The perform and studio modules stages are skipped (they need a real, tagged + - The perform stage is skipped (it needs a real, tagged `release:prepare` output to run against). - The docker, next iteration and maintenance branch stages still run, but in mock mode: the docker image is only built to a local tar (never pushed), and every @@ -290,7 +279,6 @@ pipeline { steps { withCredentials([gitCredentials, dockerCredentials, - ossrhCredentials, jiraCredentials, gpgCredentials]) { script { @@ -401,8 +389,8 @@ pipeline { stage('Maven release prepare') { steps { - withCredentials([nexusCredentials, - ossrhCredentials, + withCredentials([githubPackagesCredentials, + dockerCredentials, gpgCredentials]) { script { echo "Maven prepare release $releaseVersion (next-dev: $nextVersion; tag: $tagName)" @@ -443,8 +431,8 @@ pipeline { expression { !params.DRY_RUN } } steps { - withCredentials([nexusCredentials, - ossrhCredentials, + withCredentials([githubPackagesCredentials, + dockerCredentials, jiraCredentials, gpgCredentials]) { @@ -456,34 +444,13 @@ pipeline { } } - stage('Release studio modules') { - when { - expression { params.RELEASE_STUDIO_MODULES && !params.DRY_RUN } - } - steps { - withCredentials([nexusCredentials, - ossrhCredentials, - jiraCredentials, - gpgCredentials]) { - - script { - echo "Perform release" - sh "bash .jenkins/scripts/release/release-3.1-perform-studio.sh $releaseVersion \ - $nextVersion \ - $extraBuildParams" - } - } - } - } - stage('Release Docker image') { when { expression { !params.NO_DOCKER } } steps { withCredentials([gitCredentials, - nexusCredentials, - ossrhCredentials, + githubPackagesCredentials, dockerCredentials]) { script { echo "Docker image creation from branch $branchName with tag: $tagName on version $releaseVersion" @@ -500,8 +467,8 @@ pipeline { stage('Prepare next iteration') { steps { withCredentials([gitCredentials, - nexusCredentials, - ossrhCredentials]) { + githubPackagesCredentials, + dockerCredentials]) { script { echo "Prepare next iteration on $branchName" // Under DRY_RUN, the final git push is simulated with "--dry-run" (see script). @@ -519,8 +486,8 @@ pipeline { } steps { withCredentials([gitCredentials, - nexusCredentials, - ossrhCredentials]) { + githubPackagesCredentials, + dockerCredentials]) { script { echo "Creating a new branch named $maintenanceBranch with version $maintenanceVersion" // Under DRY_RUN, the final git push is simulated with "--dry-run" (see script). diff --git a/ci/Jenkinsfile-trivy b/ci/Jenkinsfile-trivy index 3db11eb234d6a..09606cad726fc 100644 --- a/ci/Jenkinsfile-trivy +++ b/ci/Jenkinsfile-trivy @@ -15,10 +15,14 @@ */ // Credentials -final def nexusCredentials = usernamePassword( - credentialsId: 'nexus-artifact-zl-credentials', - usernameVariable: 'NEXUS_USER', - passwordVariable: 'NEXUS_PASSWORD') +final def githubPackagesCredentials = usernamePassword( + credentialsId: 'github-packages-ci-runner-connectors-pat', + usernameVariable: 'GITHUB_PACKAGES_LOGIN', + passwordVariable: 'GITHUB_PACKAGES_TOKEN') +final def dockerCredentials = usernamePassword( + credentialsId: 'artifactory-datapwn-credentials', + usernameVariable: 'DOCKER_USER', + passwordVariable: 'DOCKER_PASS') final String repository = 'component-runtime' @@ -94,7 +98,7 @@ pipeline { stage('Build Project') { steps { - withCredentials([nexusCredentials]) { + withCredentials([dockerCredentials, githubPackagesCredentials]) { script { sh 'bash .jenkins/scripts/trivy_build_tck.sh' } @@ -105,6 +109,11 @@ pipeline { stage('Security Scan with Trivy') { steps { script { + // Trivy's pom resolver ignores MAVEN_ARGS/-s and only reads ~/.m2/settings.xml (Artifactory mirror) + sh ''' + mkdir -p "${HOME}/.m2" + cp "${WORKSPACE}/.jenkins/settings.xml" "${HOME}/.m2/settings.xml" + ''' trivyTools.generateTrivyReport("output/trivy-results.json", "output/trivy-results.html") publishHtmlReportTools.publishHtmlReport("output/trivy-results.html", "CVE Trivy Vulnerability Report") diff --git a/component-studio/pom.xml b/component-studio/pom.xml index 755e0a6a06417..de0ba31a97a5e 100644 --- a/component-studio/pom.xml +++ b/component-studio/pom.xml @@ -88,53 +88,4 @@ - - - - release-zl - - - - talend_nexus_deployment - https://artifacts-zl.talend.com/nexus/content/repositories/releases/ - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - - - diff --git a/documentation/src/main/antora/modules/ROOT/pages/release-process.adoc b/documentation/src/main/antora/modules/ROOT/pages/release-process.adoc index 99352962f9c17..f1fa21922f720 100644 --- a/documentation/src/main/antora/modules/ROOT/pages/release-process.adoc +++ b/documentation/src/main/antora/modules/ROOT/pages/release-process.adoc @@ -25,9 +25,9 @@ Add the required credentials to your Maven `settings.xml` file for the release. https://maven.apache.org/xsd/settings-1.0.0.xsd"> - ossrh - ${env.OSSRH_USER} - ${env.OSSRH_PASS} + github_packages + ${env.GITHUB_PACKAGES_LOGIN} + ${env.GITHUB_PACKAGES_TOKEN} github @@ -75,8 +75,7 @@ Add the required credentials to your Maven `settings.xml` file for the release. NOTE: All the environment variables should be either set in your environment or hardcoded inline. It is highly recommended to use Maven encryption: https://maven.apache.org/guides/mini/guide-encryption.html. -1. The OSSH variables are your Sonatype OSS repository credentials with the permissions to deploy on org.talend. -If you don't have them already, you can ask for them at https://issues.sonatype.org/projects/OSSRH using your Talend address. +1. The GITHUB_PACKAGES variables are the credentials of a GitHub account (token with `write:packages`) allowed to publish the packages of the `Talend/component-runtime` repository. Releases are no more published on Sonatype/Maven Central. 2. The GitHub variables are your GitHub account credentials. they are mainly used to update the documentation. 3. The JIRA variables are your Talend account credentials with read permissions on https://jira.talendforge.org/projects/TCOMP/. 4. The Blackduck configuration is used for security scans. diff --git a/documentation/src/main/antora/site-template.yml b/documentation/src/main/antora/site-template.yml index 1a13fe03e064f..fcc2a1d917045 100644 --- a/documentation/src/main/antora/site-template.yml +++ b/documentation/src/main/antora/site-template.yml @@ -181,8 +181,8 @@ content: - '!component-runtime-1.64.6' - '!component-runtime-1.64.7' # - '!component-runtime-1.64.8' - - '!component-runtime-1.65.0' - '!component-runtime-1.64.9' + - '!component-runtime-1.65.0' - '!component-runtime-1.*.0M*' - '!component-runtime-1.66.0' - '!component-runtime-1.67.0' @@ -199,6 +199,7 @@ content: - '!component-runtime-1.81.0' - '!component-runtime-1.82.0' # - '!component-runtime-1.83.0' + - '!component-runtime-1.2610.1' branches: - HEAD start_path: documentation/src/main/antora diff --git a/pom.xml b/pom.xml index 8e4e87c0edd9b..be15d68e46a8d 100644 --- a/pom.xml +++ b/pom.xml @@ -135,11 +135,17 @@ https://github.com/${scm.repository} - + + + github_packages + GitHub Packages component-runtime + https://maven.pkg.github.com/Talend/component-runtime + - central.portal - Central Portal Snapshots - https://central.sonatype.com/repository/maven-snapshots + github_packages + GitHub Packages component-runtime + https://maven.pkg.github.com/Talend/component-runtime @@ -236,8 +242,9 @@ 0.16.1 3.6.0 - 0.8.0 2.8 + + 1.2611.1 1.0.7 2.0.0 9.0.2 @@ -950,59 +957,27 @@ - - - false - - - true - - central.portal - Central Portal Snapshots - https://central.sonatype.com/repository/maven-snapshots/ - true - - false - - TalendOpenSourceRelease - https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/ - - - - false - true - TalendOpenSourceSnapshot - https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceSnapshot/ + github_packages + https://maven.pkg.github.com/Talend/global-artifacts - - - false - - - true - - central.portal - Central Portal Snapshots - https://central.sonatype.com/repository/maven-snapshots/ - true - false + true - TalendOpenSourceRelease - https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/ + github_packages + https://maven.pkg.github.com/Talend/global-artifacts @@ -1266,6 +1241,15 @@ maven-site-plugin ${maven-site-plugin.version} + + org.codehaus.mojo + clirr-maven-plugin + ${clirr-plugin.version} + + + ${clirr.comparison.version} + + org.apache.maven.plugins maven-release-plugin @@ -1351,11 +1335,6 @@ maven-gpg-plugin ${gpg-plugin.version} - - org.sonatype.central - central-publishing-maven-plugin - ${central-publishing-maven-plugin.version} - com.github.eirslett frontend-maven-plugin @@ -1800,19 +1779,6 @@ - - private_repository - - - - talend.snapshots - https://artifacts-zl.talend.com/nexus/content/repositories/snapshots - - - gpg2 @@ -1828,81 +1794,6 @@ release - - org.sonatype.central - central-publishing-maven-plugin - true - - central.portal - https://central.sonatype.com - true - - - - - - - - - component-studio - component-runtime-di - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - - sign - - verify - - - - - - - - snapshot - - - - org.sonatype.central - central-publishing-maven-plugin - true - - central.portal - https://central.sonatype.com - true - - org.apache.maven.plugins maven-source-plugin @@ -1945,23 +1836,10 @@ no-staging - - - - org.sonatype.central - central-publishing-maven-plugin - true - - - central.portal - true - - - - + + + true + java8 diff --git a/repository-knowledge.md b/repository-knowledge.md index 249fe344834de..7dd014498d93d 100644 --- a/repository-knowledge.md +++ b/repository-knowledge.md @@ -160,26 +160,16 @@ regular dependencies, not plugins); `UiSpecGeneratorMojoTest` covers the isolati ## CI / Jenkinsfile patterns -### Dual Maven deploy — Sonatype + internal Nexus +### Maven deploy targets (no more Sonatype, QTDI-3791) -When a stage must publish SNAPSHOTs to **both** `central.sonatype.com` (Sonatype OSS) and `artifacts-zl.talend.com` (internal Nexus), **two separate `mvn deploy` invocations are required**: - -- The first call uses `-Possrh -Psnapshot` (existing Sonatype deploy, unchanged). -- The second call uses `-Pprivate_repository` — but this profile **overrides `snapshotRepository`**, so combining both profiles in a single call silently suppresses the Sonatype publish and only deploys to Nexus. - -```groovy -// Sonatype deploy (existing — unchanged) -mvn ... -Possrh -Psnapshot deploy - -// Internal Nexus deploy (new — runs after Sonatype) -withCredentials([usernamePassword(credentialsId: 'nexusCredentials', ...)]) { - mvn ... --activate-profiles private_repository deploy -} -``` - -If the first deploy fails, the second is never triggered — correct behavior. - -_Discovered: QTDI-3123, 2026-07-10_ +Sonatype/Maven Central and the internal Nexus are no longer used. The root `distributionManagement` uses the +single server id `github_packages`: snapshots/qualified versions (``) and release versions +(``) all go to the GitHub Packages of this repository (`Talend/component-runtime`, QTDI-3872). +Maven picks the section from the version, so no profile is needed. `global-artifacts` is only used to read +dependencies (``); consumers of component-runtime snapshots/qualified versions must declare +`https://maven.pkg.github.com/Talend/component-runtime` as a repository. The studio modules are released like +any other module (no `system` scope restriction anymore). The `release` profile also attaches sources/javadoc and signs the +artifacts (`gpg2` + the `gpg-keyring` settings profile). ### `stdBranch_buildOnly` — master/maintenance build guard @@ -193,12 +183,6 @@ if (stdBranch_buildOnly) { _Discovered: QTDI-3123, 2026-07-10_ -### Nexus credentials — `nexusCredentials` - -`.jenkins/settings.xml` already has a `talend.snapshots` server entry. The credentials binding ID is `nexusCredentials`, which injects `NEXUS_USERNAME` and `NEXUS_PASSWORD`. **No `settings.xml` edits are needed** when adding a new deploy step targeting the internal Nexus — only add the `withCredentials` block in `Jenkinsfile`. - -_Discovered: QTDI-3123, 2026-07-10_ - ### JDK sources — build JDK vs. runtime JDK Two independent JDKs are in play; a JDK CVE must be assessed against each: @@ -234,7 +218,7 @@ Jenkins instance `jenkins-connectors`. Jobs are registered in flux (Job DSL); th | Flux job | Branches | Jenkinsfile | Notes | | --- | --- | --- | --- | -| `component-runtime/build` | all branches and PRs | `Jenkinsfile` | Build, Sonar, deploys (GitHub Packages, Nexus, Sonatype), Docker, Trivy. Cron `0 0 * * *` on `master` only (set in the Jenkinsfile). No longer used for releases | +| `component-runtime/build` | all branches and PRs | `Jenkinsfile` | Build, Sonar, deploy (GitHub Packages), Docker, Trivy. Cron `0 0 * * *` on `master` only (set in the Jenkinsfile). No longer used for releases | | `component-runtime/release` | `maintenance/*`, `master`, `main` | `ci/Jenkinsfile-release` | Started by hand with `ACTION` = `GA` (only on `master`) or `MAINTENANCE` (only on `maintenance/...`); try `DRY_RUN=true` first. Debug copy: `__TESTS__/jenkins-debug/component-runtime/release` | | `component-runtime/trivy-scan` | `master` | `ci/Jenkinsfile-trivy` | Flux cron, Sun–Fri 01:30 | | `component-runtime/TCOMP-api-test` | all branches and PRs | `talend-component-maven-plugin/src/it/web/.jenkins/Jenkinsfile` | Check `QA/TCOMP-api-test/pr-head`; see § CI: TCOMP-api-test | @@ -244,6 +228,12 @@ Jenkins instance `jenkins-connectors`. Jobs are registered in flux (Job DSL); th _Verified: QTDI-3623, 2026-11-09 against `component-runtime@c697eafca78`_ +### Antora version in `antora.yml` (QTDI-3805) + +`documentation/src/main/antora/antora.yml` is tracked but generated by Maven from `antora-template.yml`. `site.yml` loads every `component-runtime-*` tag, so two tags with the same `antora.yml` version fail the build with `Duplicate nav in @main`. Rules: +- `release-2-prepare.sh` runs `mvn clean process-sources --projects documentation` on the SNAPSHOT version and commits the result before `mvn release:prepare`, so the tag holds the regenerated `antora.yml`; `generated_*.adoc` are not regenerated at this phase (release-5 does it). The antora version is the SNAPSHOT version without suffix, which equals the release version; the script only warns if `antora.yml` differs. `package-lock.json` keeps `-SNAPSHOT` in the tag. The maintenance branch script does not write them. +- If a tag already has a wrong version, exclude it in `site-template.yml` (`'!component-runtime-'`, e.g. `1.2610.1`, `1.64.9`). + ## Coding rules delta No known repo-specific exceptions to the shared [coding-rules.md](https://github.com/Talend/di-ai-commons/blob/main/knowledge/rules/coding-rules.md). diff --git a/talend-component-maven-plugin/pom.xml b/talend-component-maven-plugin/pom.xml index bd107b915db3c..88a85ee6bafd2 100644 --- a/talend-component-maven-plugin/pom.xml +++ b/talend-component-maven-plugin/pom.xml @@ -35,9 +35,9 @@ 2.1.1 - 1.31.1 + 1.2611.1 jdbc - 1.55.0-SNAPSHOT + 1.2611.0-SNAPSHOT salesforce diff --git a/talend-component-maven-plugin/src/it/settings.xml b/talend-component-maven-plugin/src/it/settings.xml index 975d1a79c170c..731af2cbf11c9 100644 --- a/talend-component-maven-plugin/src/it/settings.xml +++ b/talend-component-maven-plugin/src/it/settings.xml @@ -16,22 +16,22 @@ - TalendOpenSourceRelease - ${env.NEXUS_USER} - ${env.NEXUS_PASS} + github_packages + ${env.GITHUB_PACKAGES_LOGIN} + ${env.GITHUB_PACKAGES_TOKEN} - TalendOpenSourceSnapshot - ${env.NEXUS_USER} - ${env.NEXUS_PASS} + artifactory.datapwn.com + ${env.DOCKER_USER} + ${env.DOCKER_PASS} - maven_central_proxy - Maven Central Proxy - https://artifacts-zl.talend.com/nexus/content/repositories/central/ + artifactory.datapwn.com + Internal Artifactory Maven Central cache + https://artifactory.datapwn.com/artifactory/maven-central-remote central diff --git a/talend-component-maven-plugin/src/it/web/.jenkins/Jenkinsfile b/talend-component-maven-plugin/src/it/web/.jenkins/Jenkinsfile index 52bc0bc78a140..e81f45a8e20b0 100644 --- a/talend-component-maven-plugin/src/it/web/.jenkins/Jenkinsfile +++ b/talend-component-maven-plugin/src/it/web/.jenkins/Jenkinsfile @@ -62,6 +62,9 @@ String _API_TEST_FILES_PATTERN = '**/src/it/web/test/**/*.json' String runtimeVersion = "default" String apiTesterEnv = "component_runtime_ci" String tenantInstance = "eu" +// QTDI-3757: the API tests are skipped unless requested (RUN_API_TESTS) or running on master. +// Computed in the "Prepare" stage. +boolean runApiTests = false /** * The pipeline @@ -93,6 +96,12 @@ pipeline { defaultValue: 'default', description: 'Choose the component-runtime.version to be used from Nexus. Keep default to use the pom version (1.45.0 minimum) or an other ex: 1.45.0-SNAPSHOT' ) + booleanParam( + name: 'RUN_API_TESTS', + defaultValue: false, + description: ''' + QTDI-3757: the API tests are skipped by default (API Tester /license endpoint change, QAPI-3138), + except on the master branch where they always run. Tick to force the execution on any other branch.''') booleanParam( name: 'JENKINS_DEBUG', defaultValue: false, @@ -156,6 +165,11 @@ pipeline { runtimeVersion = "default" } + runApiTests = params.RUN_API_TESTS || env.BRANCH_NAME == 'master' + if (!runApiTests) { + println "API tests skipped - QTDI-3757, run with RUN_API_TESTS=true or on master\n" + } + println "Requested tcompVersion is ${runtimeVersion}\n" if (runtimeVersion == "default") { @@ -215,6 +229,9 @@ pipeline { } } stage('Prepare component-runtime server') { + when { + expression { runApiTests } + } steps { withCredentials([_NEXUS_CREDENTIALS]) { script { @@ -240,6 +257,9 @@ pipeline { } } stage('Start component-runtime server') { + when { + expression { runApiTests } + } steps { withCredentials([_NEXUS_CREDENTIALS]) { script { @@ -253,6 +273,9 @@ pipeline { } } stage('Check component-runtime server') { + when { + expression { runApiTests } + } steps { withCredentials([_NEXUS_CREDENTIALS]) { script { @@ -262,6 +285,9 @@ pipeline { } } stage('Execute Test') { + when { + expression { runApiTests } + } steps { withCredentials([_NEXUS_CREDENTIALS, _TENANT_ID_RD]) { sh """ @@ -290,70 +316,73 @@ pipeline { always { script { - withCredentials([_NEXUS_CREDENTIALS]) { - sh """ - printf "======== Stop server\n" - bash ${_SCRIPTS_PATH}/server-registry-stop.sh ${_INSTALL_DIR} - printf "======== Generate jacoco report \n" - bash ${_SCRIPTS_PATH}/jacoco-report.sh ${_INSTALL_DIR} ${_COVERAGE_DIR} - printf "======== Generate Html reports\n" - bash ${_SCRIPTS_PATH}/jacoco-html.sh ${_TESTS_PATH} ${MAVEN_SETTINGS} - """ - archiveJenkinsLog() + if (!runApiTests) { + println "API tests skipped - QTDI-3757, nothing to publish" } - } + else { + withCredentials([_NEXUS_CREDENTIALS]) { + sh """ + printf "======== Stop server\n" + bash ${_SCRIPTS_PATH}/server-registry-stop.sh ${_INSTALL_DIR} + printf "======== Generate jacoco report \n" + bash ${_SCRIPTS_PATH}/jacoco-report.sh ${_INSTALL_DIR} ${_COVERAGE_DIR} + printf "======== Generate Html reports\n" + bash ${_SCRIPTS_PATH}/jacoco-html.sh ${_TESTS_PATH} ${MAVEN_SETTINGS} + """ + archiveJenkinsLog() + } - // recordIssues is a multi result file publisher allowing to have the same publish format on multiples analysis. - recordIssues ( - // By default, static analysis results are only recorded for stable or unstable builds, - // but not for failed builds: analysis results might be inaccurate if the build failed. - enabledForFailure: true, - // If there are errors while scanning the console log or files for issues (e.g., file pattern matches no files, - // source files could not be copied, etc.) then the warning plugin will show these errors in a separate - // view but does not alter the build state. - failOnError: false, - tools: [ - // Scan and publish to do and fix me in api test files - taskScanner( - id: 'todo-tck-api-test', - name: 'api-test Todo(low)/Fixme(high)', - includePattern: _API_TEST_FILES_PATTERN, - ignoreCase: true, - highTags: 'FIX_ME, FIXME', - lowTags: 'TO_DO, TODO' - ), - // Publish api tests as junit - junitParser( - id: 'unit-test', - name: 'tcomp API Test', - pattern: _API_TEST_RESULT_PATTERN + // recordIssues is a multi result file publisher allowing to have the same publish format on multiples analysis. + recordIssues ( + // By default, static analysis results are only recorded for stable or unstable builds, + // but not for failed builds: analysis results might be inaccurate if the build failed. + enabledForFailure: true, + // If there are errors while scanning the console log or files for issues (e.g., file pattern matches no files, + // source files could not be copied, etc.) then the warning plugin will show these errors in a separate + // view but does not alter the build state. + failOnError: false, + tools: [ + // Scan and publish to do and fix me in api test files + taskScanner( + id: 'todo-tck-api-test', + name: 'api-test Todo(low)/Fixme(high)', + includePattern: _API_TEST_FILES_PATTERN, + ignoreCase: true, + highTags: 'FIX_ME, FIXME', + lowTags: 'TO_DO, TODO' + ), + // Publish api tests as junit + junitParser( + id: 'unit-test', + name: 'tcomp API Test', + pattern: _API_TEST_RESULT_PATTERN + ) + ] ) - ] - ) - // Talend Test Orchestrator only work with the basic junit plugin - // TODO: TTO-562 - Implement recordIssues in TTO to stop using junit - junit( - checksName: 'tcomp API Test for tto', - keepLongStdio: true, // Standard output/error will be retained in the test results after the build completes. - testResults: _API_TEST_RESULT_PATTERN, - skipMarkingBuildUnstable: false, // junitParser already publish job status. - allowEmptyResults: true, // Do not fail a build on missing test result files or empty test results. - ) + // Talend Test Orchestrator only work with the basic junit plugin + // TODO: TTO-562 - Implement recordIssues in TTO to stop using junit + junit( + checksName: 'tcomp API Test for tto', + keepLongStdio: true, // Standard output/error will be retained in the test results after the build completes. + testResults: _API_TEST_RESULT_PATTERN, + skipMarkingBuildUnstable: false, // junitParser already publish job status. + allowEmptyResults: true, // Do not fail a build on missing test result files or empty test results. + ) - script { - println "====== Publish API Coverage" - publishCoverage adapters: [jacocoAdapter("**/coverage/report.xml")] - println "====== Publish HTML API Coverage" - publishHTML([ - allowMissing : true, - alwaysLinkToLastBuild: false, - keepAll : true, - reportDir : "${_COVERAGE_DIR}/html", - reportFiles : 'index.html', - reportName : 'API Coverage', - reportTitles : 'API Coverage' - ]) + println "====== Publish API Coverage" + publishCoverage adapters: [jacocoAdapter("**/coverage/report.xml")] + println "====== Publish HTML API Coverage" + publishHTML([ + allowMissing : true, + alwaysLinkToLastBuild: false, + keepAll : true, + reportDir : "${_COVERAGE_DIR}/html", + reportFiles : 'index.html', + reportName : 'API Coverage', + reportTitles : 'API Coverage' + ]) + } } // FIXME: TCOMP-2244 Meecrowave stop doesn't work so the artifact cmd is failing (file nos accessible) diff --git a/talend-component-maven-plugin/src/it/web/README.md b/talend-component-maven-plugin/src/it/web/README.md index 168e960f8b9ec..0739843432efc 100644 --- a/talend-component-maven-plugin/src/it/web/README.md +++ b/talend-component-maven-plugin/src/it/web/README.md @@ -6,6 +6,12 @@ You will find: - The "test" folder containing test projects and scenarios pushed by our API tester instance in eu.cloud.talend.com (tenant: rd.aws.eu.talend.com) - The ".jenkins" folder with jenkins files and scripts +## Execution in Jenkins (QTDI-3757) +Since the API Tester `/license` endpoint change (QAPI-3138), the API tests currently fail in the CI. +To avoid blocking the pull requests, the `TCOMP-api-test` Jenkins job skips them by default: + - On the `master` branch, the API tests always run. + - On any other branch (pull requests included), they are skipped unless the job parameter `RUN_API_TESTS` is ticked. + ## To run the tests ### Requirements If you want to run the test with maven, you will need the followings: