Add schema for jenkins formula
Change-Id: Iadf3199a1cdcda64f892ada9ecc1379a306549ef
Related-prod: PROD:20632
diff --git a/jenkins/client/lib.sls b/jenkins/client/lib.sls
index b17d844..615359d 100644
--- a/jenkins/client/lib.sls
+++ b/jenkins/client/lib.sls
@@ -1,6 +1,6 @@
{#- It's not recommended to call this state explicitly as it requires plugins and credentials #}
{% from "jenkins/map.jinja" import client with context %}
-{% for name, lib in client.get("lib",{}).iteritems() %}
+{% for name, lib in client.get('lib',{}).iteritems() %}
{%- if lib.enabled|default(True) %}
global_library_{{ name }}:
jenkins_lib.present:
@@ -9,7 +9,7 @@
{%- if lib.credential_id is defined %}
- credential_id: {{ lib.credential_id }}
{%- endif %}
- - branch: {{ lib.get("branch", "master") }}
+ - branch: {{ lib.get('branch', 'master') }}
{%- else %}
global_library_{{ name }}_absent:
jenkins_lib.absent:
diff --git a/jenkins/client/node.sls b/jenkins/client/node.sls
index f801a70..5ff3b5d 100644
--- a/jenkins/client/node.sls
+++ b/jenkins/client/node.sls
@@ -1,7 +1,7 @@
{#- It's not recommended to call this state explicitly as it may require plugins #}
{% from "jenkins/map.jinja" import client with context %}
{% for name, node in client.get("node",{}).iteritems() %}
-{% if node.get('name', name) == "master" %}
+{% if node.get('name', name) == 'master' %}
master_configuration:
jenkins_node.setup_master:
- num_executors: {{ node.get('num_executors','1') }}
@@ -20,7 +20,7 @@
- labels: {{ node.get('labels',[]) }}
{% endif %}
{%- endfor %}
-{% for node_name, label in client.get("label",{}).iteritems() %}
+{% for node_name, label in client.get('label',{}).iteritems() %}
label_for_{{ node_name }}:
jenkins_node.label:
- name: {{ node_name }}
diff --git a/jenkins/client/throttle_category.sls b/jenkins/client/throttle_category.sls
index 246a350..3884789 100644
--- a/jenkins/client/throttle_category.sls
+++ b/jenkins/client/throttle_category.sls
@@ -1,6 +1,6 @@
{#- It's not recommended to call this state explicitly as it requires plugins #}
{% from "jenkins/map.jinja" import client with context %}
-{% for name, throttle_category in client.get("throttle_category",{}).iteritems() %}
+{% for name, throttle_category in client.get('throttle_category',{}).iteritems() %}
{% if throttle_category.get('enabled', True) %}
'throttle_category_{{ name }}':
jenkins_throttle_category.present:
diff --git a/jenkins/schemas/client.yaml b/jenkins/schemas/client.yaml
new file mode 100644
index 0000000..0eaced4
--- /dev/null
+++ b/jenkins/schemas/client.yaml
@@ -0,0 +1,825 @@
+title: Jenkins client role
+description: |
+ Jenkins client role
+type: object
+additionalProperties: false
+
+required:
+- enabled
+
+properties:
+ enabled:
+ description: Enables Jenkins client
+ type: boolean
+ pkgs:
+ description: List of Jenkins master packages to be installed
+ type: array
+ items:
+ type: string
+ dir:
+ description: Jenkins client directories
+ type: object
+ additionalProperties: false
+ required: [jenkins_source_root, jenkins_jobs_root]
+ properties:
+ jenkins_source_root:
+ description: Root folder for jenkins source repositories
+ type: string
+ jenkins_jobs_root:
+ description: Root folder for jenkins jobs
+ type: string
+ source:
+ description: Jenkins client source
+ type: object
+ additionalProperties: false
+ properties:
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ engine:
+ description: Jenkins client source to install from
+ type: string
+ enum: ['git', 'local']
+ address:
+ description: Git repo address with jenkins client sources if engine is git
+ type: string
+ branch:
+ description: Git repo branch with jenkins client sources if engine is git
+ type: string
+ globalenvprop:
+ description: Jenkins global environment properties
+ type: object
+ additionalProperties: false
+ properties:
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ name:
+ description: Jenkins env property name
+ type: string
+ value:
+ description: Jenkins env property value
+ type: string
+ plugin:
+ description: Jenkins global environment properties
+ type: array
+ items:
+ type: string
+ plugin_remove_unwanted:
+ description: Whether to remove not listed plugins
+ type: boolean
+ plugin_force_remove:
+ description: Force removing plugins recursively with all dependent plugins
+ type: boolean
+ master:
+ description: Jenkins global environment properties
+ type: object
+ additionalProperties: false
+ properties:
+ protocol:
+ description: Protocol to connect to jenkins master
+ type: string
+ host:
+ description: Jenkins master host to connect to
+ type: string
+ port:
+ description: Jenkins master port to connect to
+ type: [integer, string]
+ user:
+ description: Jenkins users configuration parameters
+ type: object
+ additionalProperties: false
+ properties:
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ password:
+ description: Jenkins user password
+ type: string
+ admin:
+ description: Whether to create user as Jenkins admin
+ type: boolean
+ credential:
+ description: Configuration for Jenkins credentials
+ type: object
+ additionalProperties: false
+ properties:
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ name:
+ description: Jenkins credential name
+ type: string
+ username:
+ type: string
+ password:
+ type: string
+ desc:
+ description: Credential description
+ type: string
+ scope:
+ type: string
+ secret:
+ type: string
+ filename:
+ type: string
+ content:
+ type: string
+ key:
+ type: string
+ approved_scripts:
+ description: Jenkins approved scripts for use in pipelines
+ type: array
+ items:
+ type: string
+ artifactory:
+ description: Artifactory configuration in jenkins
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ name:
+ type: string
+ url:
+ description: Artifactory server url
+ type: string
+ credential_id:
+ description: Credential to access artifactory
+ type: string
+ gerrit:
+ description: Gerrit configuration in jenkins
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ host:
+ description: Gerrit host
+ type: string
+ port:
+ description: Gerrit port
+ type: [string, integer]
+ proxy:
+ description: Proxy to access Gerrit
+ type: string
+ username:
+ description: Username to access gerrit
+ type: string
+ email:
+ type: string
+ auth_key_file:
+ description: SSH key to access gerrit
+ type: string
+ frontendURL:
+ description: Gerrit frontend url
+ type: string
+ build_current_patches_only:
+ type: string
+ abort_new_patchsets:
+ description: Gerrit port
+ type: string
+ abort_manual_patchsets:
+ description: Gerrit port
+ type: string
+ abort_same_topic:
+ description: Gerrit port
+ type: string
+ authkey:
+ description: Path to ssh key file
+ type: string
+ auth_key_file_password:
+ type: string
+ jira:
+ description: Jenkins client directories
+ type: object
+ additionalProperties: false
+ required: [enabled]
+ properties:
+ enabled:
+ type: boolean
+ sites:
+ description: Jira sites to configure
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ link_url:
+ description: Root URL of JIRA installation for access
+ type: string
+ http_auth:
+ description: Connect to JIRA using HTTP Basic Authentication
+ type: boolean
+ use_wiki_notation:
+ description: Enable if JIRA supports Wiki notation
+ type: boolean
+ record_scm:
+ description: Whether to record scm changes in JIRA
+ type: boolean
+ disable_changelog:
+ description: Do not create JIRA hyperlinks in the changeset
+ type: boolean
+ issue_pattern:
+ description: Custom pattern to search for JIRA issue ids
+ type: string
+ any_build_result:
+ description: Update JIRA issues on any build result
+ type: boolean
+ user:
+ type: string
+ password:
+ type: string
+ conn_timeout:
+ type: string
+ visible_for_group:
+ description: Allow to read comments for JIRA group
+ type: string
+ visible_for_project:
+ description: Allow to read comments for JIRA project
+ type: string
+ timestamps:
+ description: Enable SCM change date and time entries
+ type: string
+ timestamp_format:
+ type: string
+ lib:
+ description: Jenkins libraries configuration
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ name:
+ type: string
+ url:
+ description: Git url of library to checkout from
+ type: string
+ credential_id:
+ description: Credentials to checkout library from git
+ type: string
+ branch:
+ description: Git branch of library to checkout from
+ type: string
+ node:
+ description: Jenkins slave nodes configuration
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ name:
+ description: Slave node name
+ type: string
+ num_executors:
+ description: Slave node number of executors
+ type: string
+ node_mode:
+ type: string
+ labels:
+ description: Slave node labels
+ type: array
+ items:
+ type: string
+ desc:
+ description: Slave node description
+ type: string
+ remote_home:
+ type: string
+ launcher:
+ description: Slave node launch parameters
+ type: object
+ additionalProperties: true
+ properties:
+ jvmopts:
+ description: JVM opts to run jenkins slave
+ type: string
+ type:
+ description: Connection type of jenkins slave to master
+ type: string
+ host:
+ description: Jenkins master host to connect slave to
+ type: string
+ port:
+ description: Jenkins master port to connect slave to
+ type: [integer, string]
+ username:
+ description: Username to connect to jenkins master
+ type: string
+ password:
+ description: User password to connect to jenkins master
+ type: string
+ tunnel:
+ description: Tunnel to connect to jenkins master
+ type: string
+ ret_strategy:
+ description: Slave node retention strategy from RetentionStrategy class
+ type: string
+ label:
+ description: Map of jenkins slaves and labels
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ lbl_text:
+ type: string
+ append:
+ type: boolean
+ security:
+ description: Security configuration for jenkins
+ type: object
+ additionalProperties: false
+ properties:
+ ldap:
+ description: Setup autorization via LDAP
+ type: object
+ additionalProperties: false
+ properties:
+ server:
+ description: LDAP server url
+ type: string
+ root_dn:
+ type: string
+ user_search_base:
+ type: string
+ manager_dn:
+ type: string
+ manager_password:
+ type: string
+ user_search:
+ type: string
+ group_search_base:
+ type: string
+ inhibit_infer_root_dn:
+ type: string
+ matrix:
+ description: Internal jenkins user matrix
+ type: object
+ additionalProperties: false
+ properties:
+ permissions:
+ description: Map of security martix permissions
+ type: string
+ project_based:
+ description: Flag if it is GlobalMatrix security or ProjectMatrix security
+ type: boolean
+ csrf:
+ description: Jenkins CSRF protection configuration
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ proxy_compat:
+ type: boolean
+ csp:
+ description: CSP security policy
+ type: string
+ agent2master:
+ type: object
+ additionalProperties: false
+ properties:
+ whitelisted:
+ type: string
+ file_path_rules:
+ type: boolean
+ slack:
+ description: Jenkins integration with Slack
+ type: object
+ additionalProperties: false
+ properties:
+ team_domain:
+ type: string
+ token:
+ type: boolean
+ send_as:
+ type: string
+ token_credential_id:
+ type: boolean
+ room:
+ type: string
+ smtp:
+ description: Jenkins smtp configuration
+ type: object
+ additionalProperties: false
+ properties:
+ host:
+ type: string
+ username:
+ type: boolean
+ password:
+ type: string
+ reply_to:
+ type: boolean
+ port:
+ type: [integer, string]
+ ssl:
+ type: string
+ charset:
+ type: string
+ admin_email:
+ type: string
+ theme:
+ description: Jenkins theme configuration
+ type: object
+ additionalProperties: false
+ properties:
+ css_url:
+ description: Url or path to theme CSS files
+ type: string
+ js_url:
+ description: Url or path to theme JS files
+ type: boolean
+ throttle_category:
+ description: Concurrent build configuration
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ name:
+ type: string
+ max_total:
+ description: Total maximum of concurrent builds
+ type: string
+ max_per_node:
+ description: Maximum of concurrent builds per node
+ type: string
+ max_per_label:
+ description: Maximum of concurrent builds per node labels
+ type: string
+ view:
+ description: Jenkins views configuration
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ name:
+ type: string
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: true
+ flowdurabilitylevel:
+ type: string
+ trigger_gerrit_server:
+ type: string
+ purge_jobs:
+ type: boolean
+ job_status:
+ type: object
+ additionalProperties: true
+ patternProperties:
+ "^SUCCESS|FAILURE|UNSTABLE$":
+ type: object
+ additionalProperties: false
+ properties:
+ ordinal:
+ type: string
+ color:
+ type: string
+ job:
+ description: Jenkins jobs configuration
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ $ref: "#/definitions/_job"
+ job_template:
+ description: Job templates definition
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ jobs:
+ type: array
+ items:
+ type: object
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: [integer, string]
+ name:
+ type: string
+ template:
+ $ref: "#/definitions/_job"
+
+definitions:
+ _job:
+ # Job common properties from _common.xml START
+ type: object
+ additionalProperties: false
+ properties:
+ type:
+ type: string
+ description:
+ type: string
+ display_name:
+ type: string
+ concurrent:
+ type: boolean
+ libs:
+ type: array
+ items:
+ type: string
+ auth_token:
+ type: string
+ quiet_period:
+ type: string
+ sandbox:
+ type: boolean
+ # Job parameters _parameters.xml START
+ discard:
+ type: object
+ additionalProperties: false
+ properties:
+ build:
+ type: object
+ additionalProperties: false
+ properties:
+ keep_days:
+ type: [integer, string]
+ keep_num:
+ type: [integer, string]
+ artifact:
+ type: object
+ additionalProperties: false
+ properties:
+ keep_days:
+ type: [integer, string]
+ keep_num:
+ type: [integer, string]
+ param:
+ description: Job parameters
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: false
+ properties:
+ type:
+ type: string
+ description:
+ type: string
+ choices:
+ type: array
+ items:
+ type: string
+ default:
+ type: [boolean, integer, string]
+ # Job parameters _parameters.xml END
+ plugin_properties:
+ type: object
+ additionalProperties: false
+ properties:
+ throttleconcurrents:
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ max_concurrent_per_node:
+ type: [integer, string]
+ max_concurrent_total:
+ type: [integer, string]
+ categories:
+ type: array
+ items:
+ type: string
+ throttle_option:
+ type: string
+ limit_one_job_with_matching_params:
+ type: boolean
+ script:
+ description: Parameters for pipeline jobs only
+ type: object
+ additionalProperties: false
+ properties:
+ repository:
+ description: Repository to checkout workflow file
+ type: string
+ file:
+ description: Relative path to workflow file inside repository
+ type: string
+ scm:
+ description: Job scm configuration
+ type: object
+ additionalProperties: false
+ properties:
+ github:
+ type: object
+ additionalProperties: false
+ properties:
+ url:
+ type: string
+ name:
+ type: string
+ type:
+ type: string
+ remote_name:
+ type: string
+ refspec:
+ type: string
+ url:
+ type: string
+ credentials:
+ type: string
+ branches:
+ type: array
+ items:
+ type: string
+ branch:
+ type: string
+ clone:
+ type: object
+ additionalProperties: false
+ properties:
+ shallow:
+ type: boolean
+ no_tags:
+ type: boolean
+ reference:
+ type: string
+ depth:
+ type: [integer, string]
+ honor_refspec:
+ type: boolean
+ wipe_workspace:
+ type: boolean
+ script:
+ type: string
+ trigger:
+ description: Jenkins job trigger configuration
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^reverse$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ projects:
+ type: array
+ items:
+ type: string
+ project:
+ type: string
+ state:
+ type: string
+ complete:
+ type: boolean
+ spec:
+ type: string
+ "^github$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ "^webhook$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ filter_text:
+ type: string
+ filter_expression:
+ type: string
+ print_content:
+ type: boolean
+ print_variables:
+ type: boolean
+ cause_string:
+ type: string
+ "^pollscm$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ spec:
+ type: string
+ "^gerrit$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ skip_vote:
+ type: array
+ items:
+ type: string
+ silent_mode:
+ type: boolean
+ silent_start_mode:
+ type: boolean
+ dependency_job_names:
+ type: array
+ items:
+ type: string
+ override-votes:
+ type: object
+ additionalProperties: true
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: true
+ message:
+ type: object
+ additionalProperties: true
+ properties:
+ build_start:
+ type: string
+ build_failure:
+ type: string
+ build_successful:
+ type: string
+ build_unstable:
+ type: string
+ build_not_built:
+ type: string
+ build_unsuccessful_filepath:
+ type: string
+ custom_url:
+ type: string
+ server:
+ type: string
+ event:
+ type: object
+ additionalProperties: false
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: true
+ project:
+ type: object
+ additionalProperties: true
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ type: object
+ additionalProperties: true
+ properties:
+ name:
+ type: string
+ compare_type:
+ type: string
+ branches:
+ type: array
+ items:
+ type: object
+ additionalProperties: true
+ properties:
+ compare_type:
+ type: string
+ name:
+ type: string
+ "^timer$":
+ type: object
+ additionalProperties: false
+ properties:
+ enabled:
+ type: boolean
+ spec:
+ type: string
+ # Job common properties from _common.xml END
diff --git a/jenkins/schemas/job_builder.yaml b/jenkins/schemas/job_builder.yaml
new file mode 100644
index 0000000..f76e44b
--- /dev/null
+++ b/jenkins/schemas/job_builder.yaml
@@ -0,0 +1,56 @@
+title: Jenkins Job Builder role
+description: |
+ Jenkins Job Builder role
+type: object
+additionalProperties: false
+
+required:
+- enabled
+
+properties:
+ enabled:
+ description: Enables Jenkins Job Builder installation
+ type: boolean
+ source:
+ description: Installation source parameters for Jenkins Job Builder
+ type: object
+ additionalProperties: false
+ required: [engine]
+ properties:
+ engine:
+ description: Installation source for Jenkins Job Builder. Can be one of ['pkg', 'pip']
+ type: string
+ enum: ['pkg', 'pip']
+ pkgs:
+ description: List of packages to be installed. Set if 'source' is 'pkg'
+ type: array
+ items:
+ description: Jenkins Job Builder package names
+ type: string
+ dir:
+ description: Configuration folder for Jenkins Job Builder
+ type: object
+ additionalProperties: false
+ required: [base, conf]
+ properties:
+ base:
+ description: Base configuration folder for Jenkins Job Builder
+ type: string
+ conf:
+ description: Folder for jenkins_jobs.ini file
+ type: string
+ config:
+ description: Configuration sources for Jenkins Job Builder
+ type: object
+ additionalProperties: false
+ required: [address, branch]
+ properties:
+ address:
+ description: Address of the remote repository with Jenkins Job builder configuration
+ type: string
+ branch:
+ description: Branch of the remote repository with Jenkins Job builder configuration
+ type: string
+ path:
+ description: Path to Jenkins Job Builder configuration file
+ type: string
\ No newline at end of file
diff --git a/jenkins/schemas/master.yaml b/jenkins/schemas/master.yaml
new file mode 100644
index 0000000..1a075d1
--- /dev/null
+++ b/jenkins/schemas/master.yaml
@@ -0,0 +1,154 @@
+title: Jenkins master role
+description: |
+ Jenkins master role
+type: object
+additionalProperties: false
+
+required:
+- enabled
+
+properties:
+ enabled:
+ description: Enables Jenkins master configuration
+ type: boolean
+ pkgs:
+ description: List of Jenkins master packages to be installed
+ type: array
+ items:
+ type: string
+ config:
+ description: Path to jenkins master configuration file
+ type: string
+ mode:
+ description: Jenkins master mode
+ type: string
+ slaves:
+ description: Jenkins slaves parameters
+ type: array
+ items:
+ $ref: "#/definitions/_slaves"
+ views:
+ description: Jenkins views parameters
+ type: array
+ items:
+ $ref: "#/definitions/_views"
+ http:
+ description: Jenkins master email parameters
+ type: object
+ additionalProperties: false
+ required: [port]
+ properties:
+ port:
+ description: Jenkins master http port
+ type: [integer, string]
+ java_args:
+ description: Java args for Jenkins master process
+ type: string
+ no_config:
+ description: Do not configure jenkins master
+ type: boolean
+ home:
+ description: Jenkins master home directory to store configuration
+ type: string
+ update_site_url:
+ description: Jenkins master update center url
+ type: string
+ approved_scripts:
+ description: List of approved scripts
+ type: array
+ items:
+ type: string
+ email:
+ description: Jenkins master email parameters
+ type: object
+ additionalProperties: false
+ required: [engine]
+ properties:
+ engine:
+ description: Jenkins email engine
+ type: string
+ user:
+ description: Jenkins email user
+ type: string
+ password:
+ description: Jenkins email user password
+ type: string
+ host:
+ description: Jenkins email host
+ type: string
+ port:
+ description: Jenkins email port
+ type: [integer, string]
+ sudo:
+ description: Enables nopasswd sudo for jenkins system user
+ type: boolean
+ service:
+ description: Jenkins service name
+ type: string
+ user:
+ description: Jenkins user parameters
+ type: object
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ $ref: "#/definitions/_user"
+ plugins:
+ description: Jenkins plugin parameters
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ description: Plugin name
+ type: string
+
+definitions:
+ _slaves:
+ description: Jenkins slaves parameters to connect to Jenkins master
+ type: object
+ additionalProperties: false
+ properties:
+ name:
+ description: Jenkins slave name
+ type: string
+ executors:
+ description: Jenkins slave num of executors
+ type: integer
+ mode:
+ description: Jenkins slave mode
+ type: string
+ label:
+ description: Jenkins slave label
+ type: string
+ _views:
+ description: Jenkins views parameters
+ type: object
+ additionalProperties: false
+ properties:
+ name:
+ description: Jenkins view name
+ type: string
+ regex:
+ description: Jenkins regex for jobs under view
+ type: string
+ _user:
+ type: object
+ additionalProperties: false
+ properties:
+ api_token:
+ description: Jenkins user API token
+ type: string
+ password:
+ description: Jenkins user password
+ type: string
+ public_keys:
+ description: Jenkins user public keys
+ type: array
+ items:
+ type: object
+ additionalProperties: false
+ properties:
+ key:
+ type: string
+ email:
+ description: Jenkins user email
+ type: string
diff --git a/jenkins/schemas/slave.yaml b/jenkins/schemas/slave.yaml
new file mode 100644
index 0000000..082f9d2
--- /dev/null
+++ b/jenkins/schemas/slave.yaml
@@ -0,0 +1,192 @@
+title: Jenkins slave role
+description: |
+ Jenkins slave role
+type: object
+additionalProperties: false
+
+required:
+- enabled
+
+properties:
+ enabled:
+ description: Enables Jenkins slave configuration
+ type: boolean
+ pkgs:
+ description: List of packages to be installed
+ type: array
+ items:
+ description: Jenkins slave package names
+ type: string
+ gpg:
+ description: GPG parameters for Jenkins slave
+ type: object
+ additionalProperties: false
+ required: [keypair_id]
+ properties:
+ keypair_id:
+ type: string
+ public_key:
+ type: string
+ private_key:
+ type: string
+ pbuilder:
+ description: Setup pbuilder in Jenkins slave
+ type: object
+ additionalProperties: false
+ properties:
+ ccachedir:
+ description: GPG keypair id for Jenkins slave
+ type: string
+ mirrorsite:
+ description: Site mirror for pbuilder
+ type: string
+ othermirror:
+ $ref: "#/definitions/_othermirror"
+ components:
+ description: Pbuilder components
+ type: array
+ items:
+ type: string
+ keyring:
+ description: Mirror keyring
+ type: string
+ aptcache:
+ description: Pbuilder apt cache directory
+ type: string
+ aptcachehardlink:
+ description: True if apt cache directory is hard link
+ type: boolean
+ buildplace:
+ description: Pbuilder build place folder
+ type: string
+ buildresult:
+ description: Pbuilder build result
+ type: string
+ usenetwork:
+ description: Use network in Pbuilder
+ type: boolean
+ parallel:
+ description: Number of parallel threads for Pbuilder. Set to false to use default (num of cpu)
+ type: [boolean, integer]
+ eatmydata:
+ description: Install eatmydata as extra package
+ type: boolean
+ os:
+ description: OS mirror parameters for Pbuilder
+ type: object
+ patternProperties:
+ "^[A-Za-z0-9_\\-]*$":
+ $ref: "#/definitions/_os_parameters"
+ keystone:
+ description: Configure keystone client inside jenkins slave
+ type: object
+ additionalProperties: false
+ required: [user]
+ properties:
+ user:
+ description: Keystone server user
+ type: string
+ password:
+ description: Keystone server user password
+ type: string
+ tenant:
+ description: Keystone server user tenant
+ type: string
+ url:
+ description: Keystone server url
+ type: string
+ init_script:
+ description: Path to jenkins slave init script
+ type: string
+ config:
+ description: Path to jenkins slave configuration file
+ type: string
+ service:
+ description: Jenkins slave service name
+ type: string
+ sudo:
+ description: Enables nopasswd sudo for jenkins slave user
+ type: boolean
+ user:
+ description: Jenkins slave user parameters
+ type: object
+ additionalProperties: false
+ required: [name, password]
+ properties:
+ name:
+ description: Jenkins slave user name
+ type: string
+ password:
+ description: Jenkins slave user name
+ type: string
+ master:
+ description: Parameters of Jenkins master to connect to
+ type: object
+ additionalProperties: false
+ required: [protocol, port, host]
+ properties:
+ protocol:
+ description: Protocol to connect to Jenkins master
+ type: string
+ port:
+ description: Jenkins master port to connect to
+ type: [integer, string]
+ host:
+ description: Jenkins master host to connect to
+ type: string
+ hostname:
+ description: Jenkins slave hostname
+ type: string
+
+definitions:
+ _os_parameters:
+ description: Map of OS and its distribution parameters
+ type: object
+ patternProperties:
+ "^[A-Za-z0-9]*$":
+ $ref: "#/definitions/_os_distribution_parameters"
+ _os_distribution_parameters:
+ description: Distribution parameters for particular OS
+ type: object
+ additionalProperties: false
+ properties:
+ mirrorsite:
+ description: Site mirror for pbuilder
+ type: string
+ othermirror:
+ $ref: "#/definitions/_othermirror"
+ keyring:
+ description: Keyring for distribution mirror
+ type: string
+ arch:
+ description: Distribution architecture
+ type: string
+ extrapackages:
+ description: Distribution extra packages
+ type: array
+ items:
+ type: string
+ eatmydata:
+ description: Install eatmydata as extra package
+ type: boolean
+ _othermirror:
+ description: Other mirror parameters
+ type: object
+ additionalProperties: false
+ properties:
+ trusted:
+ description: Trusted mirror or not
+ type: boolean
+ url:
+ description: Mirror url
+ type: string
+ dist:
+ description: Mirror dist
+ type: string
+ components:
+ description: Mirror components
+ type: array
+ items:
+ type: string
+
+
diff --git a/metadata.yml b/metadata.yml
index d090f37..04459ab 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -6,3 +6,5 @@
source: "https://gerrit.mcp.mirantis.com/salt-formulas/java"
- name: linux
source: "https://gerrit.mcp.mirantis.com/salt-formulas/linux"
+- name: git
+ source: "https://gerrit.mcp.mirantis.com/salt-formulas/git"
diff --git a/tests/pillar/client.sls b/tests/pillar/client.sls
index 3d2cd31..ca1cc5c 100644
--- a/tests/pillar/client.sls
+++ b/tests/pillar/client.sls
@@ -39,7 +39,7 @@
trigger:
timer:
spec: "H H * * *"
- github:
+ github: {}
pollscm:
spec: "H/15 * * * *"
reverse:
@@ -64,6 +64,34 @@
type: text
description: multi-liner
default: default_text
+ job_template:
+ template_name:
+ jobs:
+ - name: os
+ salt_url: http://localhost:6969
+ name: deploy-\{\{name}}
+ template:
+ concurrent: false
+ discard:
+ artifact:
+ keep_num: 10
+ build:
+ keep_num: 10
+ display_name: Deploy \{\{name}}
+ param:
+ SALT_MASTER_URL:
+ default: '\{\{salt_url}}'
+ type: string
+ trigger:
+ pollscm:
+ spec: "H/60 * * * *"
+ scm:
+ branch: master
+ credentials: gerrit
+ script: Jenkinsfile
+ type: git
+ url: ssh://admin@localhost:29418/project/\{\{name}}
+ type: workflow-scm
approved_scripts:
- method groovy.json.JsonSlurperClassic parseText java.lang.String
java:
diff --git a/tests/pillar/job_builder.sls b/tests/pillar/job_builder.sls
new file mode 100644
index 0000000..cfdcb26
--- /dev/null
+++ b/tests/pillar/job_builder.sls
@@ -0,0 +1,23 @@
+jenkins:
+ job_builder:
+ enabled: true
+ config:
+ address: https://github.com/test/job_builder.git
+ branch: master
+git:
+ client:
+ enabled: true
+ disable_ssl_verification: True
+ user:
+ - user:
+ name: jdoe
+ email: j@doe.com
+linux:
+ system:
+ enabled: true
+ user:
+ jdoe:
+ enabled: true
+ sudo: true
+ full_name: John Doe
+ home: /home/jdoe