From 8871cafa252c7d12dbca3bcefdcce66dfcfd495d Mon Sep 17 00:00:00 2001 From: "Benjamin R. J. Schwedler" Date: Fri, 6 Oct 2023 10:40:51 -0500 Subject: [PATCH 1/4] Update Jenkins credental --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b133eec5..a8032262 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -154,8 +154,8 @@ try { stage('Prepare B&T Container') { prepareWorkspace() def image_tag = "${current_container.os}-${current_container.arch}-${params.RLP_SDK_VERSION_MAJOR}.${params.RLP_SDK_VERSION_MINOR}" - withCredentials([usernameColonPassword(credentialsId: 'github-rstudio-jenkins', variable: "github_login")]) { - def github_args = "--build-arg GITHUB_LOGIN=${github_login}" + withCredentials([usernameColonPassword(credentialsId: 'posit-jenkins', variable: "github_login")]) { + def github_args = '--build-arg GITHUB_LOGIN=${github_login}' container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.${current_container.os}-${current_container.arch}", image_tag: image_tag, build_args: github_args + " " + jenkins_user_build_args()) } } From 7b6b6a5a2c51b701bada9f2140daf40df759d01a Mon Sep 17 00:00:00 2001 From: "Benjamin R. J. Schwedler" Date: Fri, 6 Oct 2023 12:22:07 -0500 Subject: [PATCH 2/4] Add retry(1) to several blocks in Jenkinsfile --- Jenkinsfile | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a8032262..44355254 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,14 +77,14 @@ def s3_upload() { // copy installer to s3 sh "aws s3 cp ${buildFolder}/${packageFile} s3://rstudio-launcher-plugin-sdk/" - + // copy documentation to s3 sh "aws s3 sync docs/ApiRefHtml s3://docs.rstudio.com/rlps/apiref/${version}/" sh "aws s3 sync docs/ApiRefHtml s3://docs.rstudio.com/rlps/apiref/latest/" - + sh "aws s3 sync docs/QuickStartHtml s3://docs.rstudio.com/rlps/quickstart/${version}/" sh "aws s3 sync docs/QuickStartHtml s3://docs.rstudio.com/rlps/quickstart/latest/" - + sh "aws s3 sync docs/DevGuideHtml s3://docs.rstudio.com/rlps/devguide/${version}/" sh "aws s3 sync docs/DevGuideHtml s3://docs.rstudio.com/rlps/devguide/latest/" } @@ -154,15 +154,19 @@ try { stage('Prepare B&T Container') { prepareWorkspace() def image_tag = "${current_container.os}-${current_container.arch}-${params.RLP_SDK_VERSION_MAJOR}.${params.RLP_SDK_VERSION_MINOR}" - withCredentials([usernameColonPassword(credentialsId: 'posit-jenkins', variable: "github_login")]) { - def github_args = '--build-arg GITHUB_LOGIN=${github_login}' - container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.${current_container.os}-${current_container.arch}", image_tag: image_tag, build_args: github_args + " " + jenkins_user_build_args()) + retry(1) { + withCredentials([usernameColonPassword(credentialsId: 'posit-jenkins', variable: "github_login")]) { + def github_args = '--build-arg GITHUB_LOGIN=${github_login}' + container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.${current_container.os}-${current_container.arch}", image_tag: image_tag, build_args: github_args + " " + jenkins_user_build_args()) + } } } stage('Build and Test') { container.inside("--privileged") { stage('Compile Source') { - build_source("${current_container.flavor}") + retry(1) { + build_source("${current_container.flavor}") + } } stage('Run Tests') { run_tests("${current_container.flavor}") @@ -182,10 +186,14 @@ try { container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.packaging", image_tag: "rlp-sdk-packaging", build_args: jenkins_user_build_args()) container.inside() { stage('Generate Documentation') { - generate_documentation() + retry(1) { + generate_documentation() + } } stage('Create Package') { - create_package() + retry(1) { + create_package() + } } } if (params.get('UPLOAD_PACKAGE') == true) { From e8bbd92918ec35352b3024a168c2ef75d7f16b7b Mon Sep 17 00:00:00 2001 From: "Benjamin R. J. Schwedler" Date: Fri, 6 Oct 2023 12:26:23 -0500 Subject: [PATCH 3/4] Abort previous builds on new push --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 44355254..83d1654a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,7 +26,7 @@ properties([ - disableConcurrentBuilds(), + disableConcurrentBuilds(abortPrevious: true), buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', From 801b09dcc2bad15880b3681c40f3ed7a4a275d69 Mon Sep 17 00:00:00 2001 From: "Benjamin R. J. Schwedler" Date: Fri, 6 Oct 2023 15:04:17 -0500 Subject: [PATCH 4/4] Try to work around flaky keyserver.ubuntu.com responses --- Jenkinsfile | 8 ++++++-- dependencies/install-bookdown.sh | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 83d1654a..a14796bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -120,7 +120,9 @@ try { node('docker') { stage('Prepare Versioning Container') { prepareWorkspace() - container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.versioning", image_tag: "rlp-sdk-versioning", build_args: jenkins_user_build_args()) + retry(1) { + container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.versioning", image_tag: "rlp-sdk-versioning", build_args: jenkins_user_build_args()) + } container.inside() { stage('Bump Version') { def rlpSdkVersion = sh ( @@ -183,7 +185,9 @@ try { node ('docker') { stage('Prepare Packaging Container') { prepareWorkspace() - container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.packaging", image_tag: "rlp-sdk-packaging", build_args: jenkins_user_build_args()) + retry(1) { + container = pullBuildPush(image_name: 'jenkins/rlp-sdk', dockerfile: "docker/jenkins/Dockerfile.packaging", image_tag: "rlp-sdk-packaging", build_args: jenkins_user_build_args()) + } container.inside() { stage('Generate Documentation') { retry(1) { diff --git a/dependencies/install-bookdown.sh b/dependencies/install-bookdown.sh index 77353e40..119dd5ac 100755 --- a/dependencies/install-bookdown.sh +++ b/dependencies/install-bookdown.sh @@ -49,7 +49,7 @@ if [[ $INSTALL_R -eq 1 ]]; then sudo yum install -y R else sudo apt-get -y install apt-transport-https software-properties-common - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 sudo add-apt-repository -y 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' sudo apt update sudo apt-get -y install r-base wget