Skip to content

Commit

Permalink
Jenkins: add capability to set jenkins password (#8913)
Browse files Browse the repository at this point in the history
* Jenkins: set default password and provide user data

* update

* update
  • Loading branch information
treddy08 authored Dec 5, 2024
1 parent 603d28c commit 6ef637b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ ocp4_workload_jenkins_name: jenkins

# Enable OAuth
ocp4_workload_jenkins_oauth: true

# Set to override default password with oauth disabled
ocp4_workload_jenkins_admin_password: password

# Turn off adminstrative monitors (speeds login)
ocp4_workload_jenkins_disable_admin_monitors: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,35 @@
- r_jenkins.resources[0].status.readyReplicas is defined
- r_jenkins.resources[0].status.readyReplicas == r_jenkins.resources[0].spec.replicas

- name: Save jenkins credentials
when: not ocp4_workload_jenkins_oauth
block:
- name: Retrieve Ingress config
kubernetes.core.k8s_info:
api_version: config.openshift.io/v1
kind: Ingress
name: cluster
register: r_ingress_config

- name: Save jenkins credentials
agnosticd_user_info:
data:
jenkins_console: "https://jenkins-{{
ocp4_workload_jenkins_project }}.{{ r_ingress_config.resources[0].spec.domain }}"
jenkins_admin: admin
jenkins_password: "{{ ocp4_workload_jenkins_admin_password }}"

- name: Print Admin credentials
agnosticd_user_info:
msg: "{{ item }}"
loop:
- ""
- "Your Jenkins login credentials:"
- "Jenkins console: https://jenkins-{{
ocp4_workload_jenkins_project }}.{{ r_ingress_config.resources[0].spec.domain }}"
- "Jenkins admin user: admin"
- "Jenkins admin password: {{ ocp4_workload_jenkins_admin_password }}"

# Leave this as the last task in the playbook.
- name: workload tasks complete
debug:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ spec:
value: "false"
- name: JENKINS_UC_INSECURE
value: "false"
{% if not ocp4_workload_jenkins_oauth %}
- name: JENKINS_PASSWORD
value: "{{ ocp4_workload_jenkins_admin_password }}"
{% endif %}
image: "{{ ocp4_workload_jenkins_image }}:{{ ocp4_workload_jenkins_tag }}"
imagePullPolicy: IfNotPresent
livenessProbe:
Expand Down

0 comments on commit 6ef637b

Please sign in to comment.