diff --git a/stable/jenkins/CHANGELOG.md b/stable/jenkins/CHANGELOG.md index a3daacb864..7022a04894 100644 --- a/stable/jenkins/CHANGELOG.md +++ b/stable/jenkins/CHANGELOG.md @@ -6,6 +6,10 @@ numbering uses [semantic versioning](http://semver.org). NOTE: The change log until version 1.5.7 is auto generated based on git commits. Those include a reference to the git commit to be able to get more details. +## 1.6.1 + +Print error message when `master.sidecars.configAutoReload.enabled` is `true`, but the admin user can't be found to configure the SSH key. + ## 1.6.0 Add support for Google Cloud Storage for backup CronJob (migrating from nuvo/kube-tasks to maorfr/kube-tasks) diff --git a/stable/jenkins/Chart.yaml b/stable/jenkins/Chart.yaml index 6f87f6179a..1323152a4a 100755 --- a/stable/jenkins/Chart.yaml +++ b/stable/jenkins/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: jenkins home: https://jenkins.io/ -version: 1.6.0 +version: 1.6.1 appVersion: lts description: Open source continuous integration server. It supports multiple SCM tools including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based diff --git a/stable/jenkins/templates/config.yaml b/stable/jenkins/templates/config.yaml index 693c4c9cc4..a99c31c67c 100644 --- a/stable/jenkins/templates/config.yaml +++ b/stable/jenkins/templates/config.yaml @@ -297,18 +297,20 @@ data: init-add-ssh-key-to-admin.groovy: |- import jenkins.security.* import hudson.model.User - import jenkins.security.ApiTokenProperty import jenkins.model.Jenkins - User u = User.get("{{ .Values.master.adminUser | default "admin" }}") - ApiTokenProperty t = u.getProperty(ApiTokenProperty.class) - String sshKeyString = new File('/var/jenkins_home/key.pub').text - keys_param = new org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl(sshKeyString) - u.addProperty(keys_param) - def inst = Jenkins.getInstance() - def sshDesc = inst.getDescriptor("org.jenkinsci.main.modules.sshd.SSHD") - sshDesc.setPort({{ .Values.master.sidecars.configAutoReload.sshTcpPort | default 1044 }}) - sshDesc.getActualPort() - sshDesc.save() + User user = User.get("{{ .Values.master.adminUser | default "admin" }}", false) + if (user == null) { + System.err.println("ERROR: user '{{ .Values.master.adminUser | default "admin" }}' not found! Can't configure SSH key which is needed to reload JCasC config!") + } else { + String sshKeyString = new File('/var/jenkins_home/key.pub').text + keys_param = new org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl(sshKeyString) + user.addProperty(keys_param) + def inst = Jenkins.getInstance() + def sshDesc = inst.getDescriptor("org.jenkinsci.main.modules.sshd.SSHD") + sshDesc.setPort({{ .Values.master.sidecars.configAutoReload.sshTcpPort | default 1044 }}) + sshDesc.getActualPort() + sshDesc.save() + } {{- else }} # Only add config to this script if we aren't auto-reloading otherwise the pod will restart upon each config change: {{- range $key, $val := .Values.master.JCasC.configScripts }}