Skip to content

Commit

Permalink
AMW-239 Reorganize tabs in Jenkins by product rather project type
Browse files Browse the repository at this point in the history
  • Loading branch information
RanabirChakraborty committed Jan 22, 2025
1 parent cd443a8 commit 83a6bd7
Show file tree
Hide file tree
Showing 7 changed files with 318 additions and 32 deletions.
10 changes: 10 additions & 0 deletions molecule/jenkins_casc_check/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Converge
hosts: all
vars_files:
- vars.yml
tasks:
- name: Generate casc.yaml from template
ansible.builtin.template:
src: "../../roles/jenkins/templates/casc.yaml.j2"
dest: "/tmp/casc_generated.yaml"
35 changes: 35 additions & 0 deletions molecule/jenkins_casc_check/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
driver:
name: podman
platforms:
- name: instance
image: registry.access.redhat.com/ubi9/ubi-init:latest
pre_build_image: true
privileged: true
command: "/usr/sbin/init"
packages:
- sudo
provisioner:
name: ansible
playbooks:
prepare: prepare.yml
converge: converge.yml
verify: verify.yml
env:
ANSIBLE_FORCE_COLOR: "true"
ANSIBLE_ROLES_PATH: "../../roles"
verifier:
name: ansible
scenario:
test_sequence:
- cleanup
- destroy
- syntax
- create
- prepare
- converge
- idempotence
- side_effect
- verify
- cleanup
- destroy
18 changes: 18 additions & 0 deletions molecule/jenkins_casc_check/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Prepare
hosts: all
gather_facts: yes
tasks:

- name: "Include common prepare tasks"
ansible.builtin.include_tasks: ../prepare.yml

- name: Ensure pip3 is installed
ansible.builtin.yum:
name: python3-pip
state: present

- name: Install PyYAML
ansible.builtin.pip:
name: pyyaml
state: present
143 changes: 143 additions & 0 deletions molecule/jenkins_casc_check/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
jenkins:
groupname: "jenkins"
bind_addr: "localhost"
port: "8080"
username: "jenkins"
uid: "1000"
gid: "1000"
home: "/home/jenkins/current"
home_next: "/home/jenkins/next"
tools:
home: "/opt/tools"
executors:
num: "12"
default_jdk_home: "/opt/oracle/java"
default_mvn_home: "/opt/apache/maven"
default_mvn_settings: "/opt/tools/settings.xml"
jdk_list:
jdk8: "/opt/oracle/jdk1.8.0_181"
jdk17: "/opt/oracle/jdk-17.0.1"
admin:
id: "admin"
password: "admin_password"
ldap:
search:
group:
base: ""
filter: ""
inhibit_root_dn: false
rootDn: ""
host: ""
port: "636"
url: ""
role:
admin:
name: "admin"
group: "admins"
desc: "Administrator role"
ansibleCI:
name: "ansibleCI"
group: "ansible-ci-group"
desc: "Ansible CI role"
user:
name: "user"
group: "users"
desc: "Regular user role"
view:
- name: "Ansible AMQ Broker"
includeRegex: ".*amq.*"
- name: "Ansible CI"
includeRegex: "ansible-ci-.*"
- name: "Ansible DOT"
includeRegex: "ansible-downstream-tests-.*"
- name: "Ansible Demos"
includeRegex: ".*-demo"
- name: "Ansible Downstream CI"
includeRegex: "ansible-downstream-ci-.*"
- name: "Ansible Downstream Runner"
includeRegex: "ansible-downstream-runner-.*"
- name: "Ansible EAP"
includeRegex: ".*(wildfly|eap).*"
excludeRegex: '.*eap-[0-9]+\\.[0-9]+.*|wildfly-.*'
- name: "Ansible JWS"
includeRegex: ".*jws.*"
- name: "Ansible Janus"
includeRegex: "ansible-janus-.*"
- name: "Ansible Quarkus"
includeRegex: ".*quarkus.*"
- name: "Ansible Release"
includeRegex: "ansible-release-.*"
- name: "Component Alignment"
includeRegex: "component-alignment-.*"
- name: "SET CI"
includeRegex: "ci-.*"
- name: "eap-6.4.x"
includeRegex: 'eap-6\\.4\\.x-.*'
- name: "eap-7.0.x"
includeRegex: 'eap-7\\.0\\.x-.*'
- name: "eap-7.1.x"
includeRegex: 'eap-7\\.1\\.x-.*'
- name: "eap-7.2.x"
includeRegex: 'eap-7\\.2\\.x-.*'
- name: "eap-7.3.x"
includeRegex: 'eap-7\\.3\\.x-.*'
- name: "eap-7.4.x"
includeRegex: 'eap-7\\.4\\.x-.*'
- name: "eap-8.0.x"
includeRegex: 'eap-8\\.0\\.x-.*'
- name: "vbe"
includeRegex: "vbe-eap-.*"
- name: "vbe-wildfly"
includeRegex: "vbe-wildfly-.*"
- name: "wildfly"
includeRegex: "wildfly-.*"
- name: "xp-2.0.x"
includeRegex: 'xp-2\\.0\\.x-.*'
- name: "xp-3.0.x"
includeRegex: 'xp-3\\.0\\.x-.*'
- name: "xp-4.0.x"
includeRegex: 'xp-4\\.0\\.x-.*'
- name: "cryo"
includeRegex: "cryo-.*"
service:
- name: "hephaestus"
ip: "10.88.0.3"
location: "/jenkins"
readwrite_volumes:
- { src: "/home/jenkins/current", dest: "/var/jenkins_home" }
readonly_volumes:
- { src: "/home/jenkins/.ssh", dest: "/var/jenkins_home/.ssh" }
- { src: "/home/jenkins/.netrc", dest: "/var/jenkins_home/.netrc" }
- { src: "/home/jenkins/.gitconfig", dest: "/var/jenkins_home/.gitconfig" }
add_hosts:
- { src: "podman", ip: "10.88.0.3" }
- { src: "server", ip: "10.88.0.2" }
ports_mapping:
- { src: "8080", dest: "8080" }
vars:
- { name: "JENKINS_OPTS", value: "--prefix=/jenkins" }
- name: "hephaestus.next"
ip: "10.88.1.0"
location: "/jenkins.next"
state: "stopped"
enable: "no"
readwrite_volumes:
- { src: "/home/jenkins/next", dest: "/var/jenkins_home" }
readonly_volumes:
- { src: "/home/jenkins/.ssh", dest: "/var/jenkins_home/.ssh" }
- { src: "/home/jenkins/.netrc", dest: "/var/jenkins_home/.netrc" }
- { src: "/home/jenkins/.gitconfig", dest: "/var/jenkins_home/.gitconfig" }
add_hosts:
- { src: "podman", ip: "10.88.0.3" }
- { src: "server", ip: "10.88.0.2" }
ports_mapping:
- { src: "8080", dest: "8180" }
vars:
- { name: "JENKINS_OPTS", value: "--prefix=/jenkins.next" }
instance:
url: "http://example.jenkins.server"
mailer:
replyTo: "[email protected]"
smtp:
host: "smtp.example.com"
port: "587"
10 changes: 10 additions & 0 deletions molecule/jenkins_casc_check/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Verify generated casc.yml
hosts: all
gather_facts: false
tasks:
- name: Ensure casc.yml is valid YAML
shell: "python3 -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < /tmp/casc_generated.yaml"
register: yaml_check
failed_when: yaml_check.rc != 0
changed_when: false
79 changes: 47 additions & 32 deletions roles/jenkins/templates/casc.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -125,44 +125,60 @@ jenkins:
- id: {{ jenkins.admin.id }}
password: {{ jenkins.admin.password }}
{% endif %}
{% if jenkins.view.tabs is defined %}
views:
{% if jenkins.view is defined %}
views:
- all:
name: "all"

- dashboard:
name: "cryo"
{% for view in jenkins.view %}
- list:
name: "{{ view.name }}"
columns:
{% for col in jenkins.view.tabs.columns %}
- "{{ col }}"
{% endfor %}
includeStdJobList: true
- "status"
- "weather"
- "jobName"
- "lastSuccess"
- "lastFailure"
- "lastDuration"
- "buildButton"
{% if view.includeRegex is defined%}
includeRegex: "{{ view.includeRegex }}"
{% endif %}
{% if view.excludeRegex is defined%}
excludeRegex: "{{ view.excludeRegex }}"
{% endif %}
{% if view.jobNames is defined%}
jobNames:
includeRegex: "cryo-.*"

- dashboard:
{% for jobName in view.jobNames %}
- "{{ jobName }}"
{% endfor %}
{% endif %}
{% endfor %}
- list:
name: "Failing Jobs"
columns:
{% for col in jenkins.view.tabs.columns %}
- "{{ col }}"
{% endfor %}
includeStdJobList: true
- "status"
- "weather"
- "jobName"
- "lastSuccess"
- "lastFailure"
- "lastDuration"
- "buildButton"
jobNames: []
jobFilters:
- jobStatusFilter:
aborted: false
disabled: false
failed: true
includeExcludeTypeString: "includeMatched"
stable: false
unstable: false
- jobStatusFilter:
aborted: false
disabled: true
failed: false
includeExcludeTypeString: "excludeMatched"
stable: false
unstable: false
viewsTabBar: "standard"
- jobStatusFilter:
aborted: false
disabled: false
failed: true
includeExcludeTypeString: "includeMatched"
stable: false
unstable: false
- jobStatusFilter:
aborted: false
disabled: true
failed: false
includeExcludeTypeString: "excludeMatched"
stable: false
unstable: false
{% endif %}

security:
Expand Down Expand Up @@ -194,4 +210,3 @@ unclassified:
jobs:
- url: "https://raw.githubusercontent.com/jboss-set/cedalion/main/job-configurator.groovy"
- script: "queue('job-configurator')"

55 changes: 55 additions & 0 deletions roles/jenkins/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,61 @@ jenkins:
group: "{{ jenkins_role_user_group }}"
desc: "{{ jenkins_role_user_desc }}"
view:
- name: "Ansible AMQ Broker"
includeRegex: ".*amq.*"
- name: "Ansible CI"
includeRegex: "ansible-ci-.*"
- name: "Ansible DOT"
includeRegex: "ansible-downstream-tests-.*"
- name: "Ansible Demos"
includeRegex: ".*-demo"
- name: "Ansible Downstream CI"
includeRegex: "ansible-downstream-ci-.*"
- name: "Ansible Downstream Runner"
includeRegex: "ansible-downstream-runner-.*"
- name: "Ansible EAP"
includeRegex: ".*(wildfly|eap).*"
excludeRegex: '.*eap-[0-9]+\\.[0-9]+.*|wildfly-.*'
- name: "Ansible JWS"
includeRegex: ".*jws.*"
- name: "Ansible Janus"
includeRegex: "ansible-janus-.*"
- name: "Ansible Quarkus"
includeRegex: ".*quarkus.*"
- name: "Ansible Release"
includeRegex: "ansible-release-.*"
- name: "Component Alignment"
includeRegex: "component-alignment-.*"
- name: "SET CI"
includeRegex: "ci-.*"
- name: "eap-6.4.x"
includeRegex: 'eap-6\\.4\\.x-.*'
- name: "eap-7.0.x"
includeRegex: 'eap-7\\.0\\.x-.*'
- name: "eap-7.1.x"
includeRegex: 'eap-7\\.1\\.x-.*'
- name: "eap-7.2.x"
includeRegex: 'eap-7\\.2\\.x-.*'
- name: "eap-7.3.x"
includeRegex: 'eap-7\\.3\\.x-.*'
- name: "eap-7.4.x"
includeRegex: 'eap-7\\.4\\.x-.*'
- name: "eap-8.0.x"
includeRegex: 'eap-8\\.0\\.x-.*'
- name: "vbe"
includeRegex: "vbe-eap-.*"
- name: "vbe-wildfly"
includeRegex: "vbe-wildfly-.*"
- name: "wildfly"
includeRegex: "wildfly-.*"
- name: "xp-2.0.x"
includeRegex: 'xp-2\\.0\\.x-.*'
- name: "xp-3.0.x"
includeRegex: 'xp-3\\.0\\.x-.*'
- name: "xp-4.0.x"
includeRegex: 'xp-4\\.0\\.x-.*'
- name: "cryo"
includeRegex: "cryo-.*"
service:
- name: hephaestus
ip: "{{ known_hosts.jenkins.ip }}"
Expand Down

0 comments on commit 83a6bd7

Please sign in to comment.