From 0fdb252eb26aada40c7641fa542a3fb26f3d72fe Mon Sep 17 00:00:00 2001 From: Ben Kristinsson Date: Wed, 23 Oct 2024 07:14:43 +0200 Subject: [PATCH 1/5] agent label hcloud-docker-x86 --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 86e916c..19fe510 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,7 @@ pipeline { - agent any + agent { + label "hcloud-docker-x86" + } parameters { booleanParam(name: "use_github", defaultValue: true, description: "use github repos") booleanParam(name: "BUILD_SNAPSHOT", defaultValue: false, description: "build current version at HEAD") -- 2.40.1 From e7939b75931a9477fcb509511ed7592a1735704a Mon Sep 17 00:00:00 2001 From: Ben Kristinsson Date: Fri, 25 Oct 2024 12:37:06 +0200 Subject: [PATCH 2/5] no building --- Jenkinsfile | 99 ++++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19fe510..e9ac072 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,55 +22,62 @@ pipeline { FORCE_COLOR="1" } stages { - stage('checkout') { + stage('test') { steps { script { - // used in post success - env.GITEA_USER = env.JOB_NAME.split('/')[0] - env.GITEA_SECRET_ID = "gitea-user-${env.GITEA_USER}-full-token" - env.VALETUDO_GIT_URL = params.use_github ? "https://github.com/Hypfer" : "https://git.sudo.is/mirrors" - sh "env" + sh "hostname" + } + } + } + // stage('checkout') { + // steps { + // script { + // // used in post success + // env.GITEA_USER = env.JOB_NAME.split('/')[0] + // env.GITEA_SECRET_ID = "gitea-user-${env.GITEA_USER}-full-token" + // env.VALETUDO_GIT_URL = params.use_github ? "https://github.com/Hypfer" : "https://git.sudo.is/mirrors" + // sh "env" - dir('Valetudo') { - git(url: env.VALETUDO_GIT_URL + "/Valetudo", branch: env.VALETUDO_MAIN_BRANCH) - sh("git fetch --tags") - env.VALETUDO_VERSION = sh(script: "../.pipeline/version.sh", returnStdout: true).trim() - if (env.BUILD_SNAPSHOT != "true") { - sh "git checkout ${env.VALETUDO_VERSION}" - } - } - currentBuild.displayName += " - ${env.VALETUDO_VERSION}" - currentBuild.description = "Valetudo ${env.VALETUDO_VERSION}" - writeFile(file: "dist/valetudo_version.txt", text: env.VALETUDO_VERSION) - } - sh "ls --color=always -l" - } - } - stage('build') { - steps { - sh ".pipeline/build.sh" - } - } - stage('checksums') { - steps { - sh ".pipeline/check-sha256sums.sh" - } - } - stage('package') { - steps { - sh ".pipeline/package.sh" - } - } - stage('publish') { - when { - branch "main" - } - steps { - withCredentials([string(credentialsId: env.GITEA_SECRET_ID, variable: 'GITEA_SECRET')]) { - sh ".pipeline/publish.sh" - } - } - } + // dir('Valetudo') { + // git(url: env.VALETUDO_GIT_URL + "/Valetudo", branch: env.VALETUDO_MAIN_BRANCH) + // sh("git fetch --tags") + // env.VALETUDO_VERSION = sh(script: "../.pipeline/version.sh", returnStdout: true).trim() + // if (env.BUILD_SNAPSHOT != "true") { + // sh "git checkout ${env.VALETUDO_VERSION}" + // } + // } + // currentBuild.displayName += " - ${env.VALETUDO_VERSION}" + // currentBuild.description = "Valetudo ${env.VALETUDO_VERSION}" + // writeFile(file: "dist/valetudo_version.txt", text: env.VALETUDO_VERSION) + // } + // sh "ls --color=always -l" + // } + // } + // stage('build') { + // steps { + // sh ".pipeline/build.sh" + // } + // } + // stage('checksums') { + // steps { + // sh ".pipeline/check-sha256sums.sh" + // } + // } + // stage('package') { + // steps { + // sh ".pipeline/package.sh" + // } + // } + // stage('publish') { + // when { + // branch "main" + // } + // steps { + // withCredentials([string(credentialsId: env.GITEA_SECRET_ID, variable: 'GITEA_SECRET')]) { + // sh ".pipeline/publish.sh" + // } + // } + // } } post { always { -- 2.40.1 From 85e19c87d06e50e3f4aaf47c2d1547a9f6e1f2c6 Mon Sep 17 00:00:00 2001 From: Ben Kristinsson Date: Fri, 25 Oct 2024 12:51:04 +0200 Subject: [PATCH 3/5] run docker --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index e9ac072..9c9c049 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,6 +26,7 @@ pipeline { steps { script { sh "hostname" + sh "docker run --rm -it ubuntu:latest hostname" } } } -- 2.40.1 From 9a7625a82f0ff809ed49e797dc1cd03af660e6dc Mon Sep 17 00:00:00 2001 From: Ben Kristinsson Date: Fri, 25 Oct 2024 12:52:07 +0200 Subject: [PATCH 4/5] non interactively --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9c9c049..045a567 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,7 +26,7 @@ pipeline { steps { script { sh "hostname" - sh "docker run --rm -it ubuntu:latest hostname" + sh "docker run --rm ubuntu:latest hostname" } } } -- 2.40.1 From e05da574d2828ae2be3c350f81aa961bb59b07b4 Mon Sep 17 00:00:00 2001 From: Ben Kristinsson Date: Fri, 25 Oct 2024 12:53:26 +0200 Subject: [PATCH 5/5] build --- Jenkinsfile | 96 ++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 045a567..19fe510 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,63 +22,55 @@ pipeline { FORCE_COLOR="1" } stages { - stage('test') { + stage('checkout') { steps { script { - sh "hostname" - sh "docker run --rm ubuntu:latest hostname" + // used in post success + env.GITEA_USER = env.JOB_NAME.split('/')[0] + env.GITEA_SECRET_ID = "gitea-user-${env.GITEA_USER}-full-token" + env.VALETUDO_GIT_URL = params.use_github ? "https://github.com/Hypfer" : "https://git.sudo.is/mirrors" + sh "env" + + dir('Valetudo') { + git(url: env.VALETUDO_GIT_URL + "/Valetudo", branch: env.VALETUDO_MAIN_BRANCH) + sh("git fetch --tags") + env.VALETUDO_VERSION = sh(script: "../.pipeline/version.sh", returnStdout: true).trim() + if (env.BUILD_SNAPSHOT != "true") { + sh "git checkout ${env.VALETUDO_VERSION}" + } + } + currentBuild.displayName += " - ${env.VALETUDO_VERSION}" + currentBuild.description = "Valetudo ${env.VALETUDO_VERSION}" + writeFile(file: "dist/valetudo_version.txt", text: env.VALETUDO_VERSION) + } + sh "ls --color=always -l" + } + } + stage('build') { + steps { + sh ".pipeline/build.sh" + } + } + stage('checksums') { + steps { + sh ".pipeline/check-sha256sums.sh" + } + } + stage('package') { + steps { + sh ".pipeline/package.sh" + } + } + stage('publish') { + when { + branch "main" + } + steps { + withCredentials([string(credentialsId: env.GITEA_SECRET_ID, variable: 'GITEA_SECRET')]) { + sh ".pipeline/publish.sh" } } } - // stage('checkout') { - // steps { - // script { - // // used in post success - // env.GITEA_USER = env.JOB_NAME.split('/')[0] - // env.GITEA_SECRET_ID = "gitea-user-${env.GITEA_USER}-full-token" - // env.VALETUDO_GIT_URL = params.use_github ? "https://github.com/Hypfer" : "https://git.sudo.is/mirrors" - // sh "env" - - // dir('Valetudo') { - // git(url: env.VALETUDO_GIT_URL + "/Valetudo", branch: env.VALETUDO_MAIN_BRANCH) - // sh("git fetch --tags") - // env.VALETUDO_VERSION = sh(script: "../.pipeline/version.sh", returnStdout: true).trim() - // if (env.BUILD_SNAPSHOT != "true") { - // sh "git checkout ${env.VALETUDO_VERSION}" - // } - // } - // currentBuild.displayName += " - ${env.VALETUDO_VERSION}" - // currentBuild.description = "Valetudo ${env.VALETUDO_VERSION}" - // writeFile(file: "dist/valetudo_version.txt", text: env.VALETUDO_VERSION) - // } - // sh "ls --color=always -l" - // } - // } - // stage('build') { - // steps { - // sh ".pipeline/build.sh" - // } - // } - // stage('checksums') { - // steps { - // sh ".pipeline/check-sha256sums.sh" - // } - // } - // stage('package') { - // steps { - // sh ".pipeline/package.sh" - // } - // } - // stage('publish') { - // when { - // branch "main" - // } - // steps { - // withCredentials([string(credentialsId: env.GITEA_SECRET_ID, variable: 'GITEA_SECRET')]) { - // sh ".pipeline/publish.sh" - // } - // } - // } } post { always { -- 2.40.1