commit ca55d301dc227d9fd8ee8f7c1f5c941b5090b1fd
parent 81da8f24b9a8cd4e300750a834690aeb8c4ede5d
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sun, 11 Aug 2024 12:01:37 +0200
feat(Jenkinsfile): add updatecli
Diffstat:
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
@@ -1,6 +1,20 @@
@Library('in0rdr-jenkins-lib@master') _
+def updatecli = new Updatecli(this)
+
+// https://plugins.jenkins.io/hashicorp-vault-plugin/#user-content-usage-via-jenkinsfile
+def secrets = [
+ [path: 'kv/jenkins-secrets/git', secretValues: [
+ [envVar: 'GIT_USERNAME', vaultKey: 'username'],
+ [envVar: 'GIT_PASSWORD', vaultKey: 'password']
+ ]]
+]
+
node('podman'){
checkout scm
gitleaks()
+
+ withVault([vaultSecrets: secrets]) {
+ updatecli.run('apply')
+ }
}
diff --git a/updatecli.d/default.yaml b/updatecli.d/default.yaml
@@ -0,0 +1,36 @@
+name: Update go dependencies
+# use jenkins $BUILD_NUMBER env var
+pipelineid: {{ requiredEnv "BUILD_NUMBER" }}
+scms:
+ default:
+ # https://www.updatecli.io/docs/core/scm
+ kind: git
+ spec:
+ url: "https://git.in0rdr.ch/hivedav.git"
+ # read git credentials from jenkins secret
+ username: {{ requiredEnv "GIT_USERNAME" }}
+ password: {{ requiredEnv "GIT_PASSWORD" }}
+ user: {{ requiredEnv "GIT_AUTHOR_NAME" }}
+ email: {{ requiredEnv "GIT_AUTHOR_EMAIL" }}
+ # source branch
+ branch: master
+ # create remote target branch updatecli_master_$PIPELINEID to push changes
+ workingbranch: true
+ # reuse existing target branch updatecli_master_$PIPELINEID
+ force: true
+
+# no targets, use autodiscovery
+# - https://www.updatecli.io/docs/guides/npm
+# - https://www.updatecli.io/docs/core/autodiscovery
+autodiscovery:
+ scmid: default
+ crawlers:
+ # https://www.updatecli.io/docs/plugins/autodiscovery/golang
+ golang/gomod:
+ versionfilter:
+ kind: latest
+
+actions:
+ default:
+ kind: git
+ scmid: default