myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

commit f259267ffab3e1517009ee2a29e06024cc1d9b95
parent cff69d36fb51684e2314fbb433ea8aaee5b04fc8
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Sun, 30 Jun 2024 15:08:42 +0200

feat(Jenkins): use updatecli lib

Diffstat:
AJenkinsfile | 20++++++++++++++++++++
Aupdatecli.d/default.yaml | 34++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile @@ -0,0 +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,34 @@ +name: Update npm 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/myheats.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/npm + npm: + +actions: + default: + kind: git + scmid: default