From d35987d63e7b91d0f035787f3b843d0f99da2518 Mon Sep 17 00:00:00 2001 From: 12WW1160 Date: Fri, 4 Dec 2020 16:12:16 +0100 Subject: [PATCH] add jenkinsfile --- CHANGELOG.md | 81 -------------------- Gemfile | 8 +- Jenkinsfile | 211 ++++++++++----------------------------------------- README.md | 13 ++-- 4 files changed, 49 insertions(+), 264 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 32a0453..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,81 +0,0 @@ -

Git Changelog changelog

- -

-Changelog of Git Changelog. -

- -

Unreleased

-

No issue

- - -199800e57a69be9 Jenkins Server 2017-08-03 11:35:51 -

-

recommit for updates in build 7

- -

-73df1183c06d683 Jenkins Server 2017-07-20 12:47:36 -

-

recommit for updates in build 4

- -

-dfeece2215322e3 Jenkins Server 2017-07-20 12:43:32 -

-

recommit for updates in build 3

- -

-c7e77e4c88c5b5a Jenkins Server 2017-07-20 12:08:03 -

-

recommit for updates in build 2

- -

- -

v0.0.1.0

-

No issue

- - -0bd13076fd01a31 Arne Teuke 2017-08-03 11:36:11 -

-

updated parameter documentation and README

- -

-a1177ccacf0d7d5 Arne Teuke 2017-08-03 11:24:18 -

-

added selinux status configuration

- -

-914509740f787b8 Arne Teuke 2017-08-03 11:19:53 -

-

added selinux status configuration

- -

- -

v0.0.0.3

-

No issue

- - -8b184516c46ea66 Arne Teuke 2017-07-20 12:47:27 -

-

edited README

- -

-6e8e556e2e2f7ef Arne Teuke 2017-07-20 12:46:33 -

-

changed repo dependency

- -

-9f8a0aef46d59dd Arne Teuke 2017-07-20 12:43:17 -

-

added main config file control

- -

-8b0100d73a0a456 Arne Teuke 2017-07-20 12:07:11 -

-

added main config file control

- -

-d6485074480abf9 Arne Teuke 2017-07-20 11:49:07 -

-

added main directory control

- -

- diff --git a/Gemfile b/Gemfile index 991761c..e9584ba 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,20 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['<= 5.5.6'] -gem 'metadata-json-lint' +gem 'metadata-json-lint', '~> 2.4' gem 'puppet', puppetversion gem 'puppetlabs_spec_helper', '>= 1.0.0' gem 'puppet-lint' gem 'facter' gem 'rspec-puppet' gem 'yard' - gem 'puppet-strings', '< 2.0.0' -gem 'rake' +gem 'puppet-strings', '< 2.0.0' +gem 'rake', '~> 12.3', '>= 12.3.3' gem 'semantic_puppet' gem 'rgen' gem 'public_suffix', '<= 2.0.5' +gem 'parallel', '<= 1.13.0' +gem 'puppet-syntax', '~> 2.6', '>= 2.6.1' # rspec must be v2 for ruby 1.8.7 if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' diff --git a/Jenkinsfile b/Jenkinsfile index b3e695b..c386296 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,9 +3,24 @@ pipeline { label 'puppet' } + post { + always { + deleteDir() /* clean up our workspace */ + } + success { + updateGitlabCommitStatus state: 'success' + echo 'Pipeline finished successfully!' + } + failure { + updateGitlabCommitStatus state: 'failed' + echo 'I failed :(' + step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true]) + } + } + stages { - stage('pulling master before adding files') { + stage('pulling master') { steps { sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) { sh '''git config user.name "Jenkins Server" @@ -16,13 +31,29 @@ pipeline { } } - stage('install required gems') { + stage('install gems') { steps { sh 'bundle install' } } - stage('puppet-lint tests') { + stage('puppet parser') { + steps { + sh '''for file in $(find . -iname \'*.pp\'); do + /opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1; + done;''' + } + } + + stage('check templates') { + steps{ + sh '''for file in $(find . -iname \'*.erb\'); + do erb -P -x -T "-" $file | ruby -c || exit 1; + done;''' + } + } + + stage('puppet-lint') { steps { sh '''find . -iname *.pp -exec /var/lib/jenkins/bin/puppet-lint \\ --no-class_inherits_from_params_class-check \\ @@ -31,32 +62,12 @@ pipeline { --no-arrow_alignment-check \\ --no-autoloader_layout-check \\ --no-140chars-check \\ - --log-format "%{path}:%{line}:%{check}:%{KIND}:%{message}" {} \\;''' + --log-format "%{path}:%{line}:%{check}:%{KIND}:%{message}" {} \\; + ''' + recordIssues aggregatingResults: true, tool: puppetLint() } } - stage('puppet parser test') { - steps { - sh '''for file in $(find . -iname \'*.pp\'); do - /opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1; - done;''' - } - } - - stage('Puppet ERB template test') { - steps{ - sh '''for file in $(find . -iname \'*.erb\'); - do erb -P -x -T "-" $file | ruby -c || exit 1; - done;''' - } - } - - stage('compiler warnings') { - steps { - warnings canComputeNew: false, canResolveRelativePaths: false, consoleParsers: [[parserName: 'Puppet-Lint']], defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: '' - } - } - stage('update repo structure') { steps { sh '''rm -Rf REPOSTRUCTURE.md @@ -70,125 +81,7 @@ pipeline { } } - stage('create changelog') { - steps{ - step([$class: 'GitChangelogRecorder', config: [configFile: 'git-changelog-settings.json', createFileTemplateContent: '''

Git Changelog changelog

- -

-Changelog of Git Changelog. -

- -{{#tags}} -

{{name}}

- {{#issues}} - {{#hasIssue}} - {{#hasLink}} -

{{name}} {{issue}} {{title}}

- {{/hasLink}} - {{^hasLink}} -

{{name}} {{issue}} {{title}}

- {{/hasLink}} - {{/hasIssue}} - {{^hasIssue}} -

{{name}}

- {{/hasIssue}} - - - {{#commits}} -{{hash}} {{authorName}} {{commitTime}} -

-

{{{messageTitle}}}

- -{{#messageBodyItems}} -
  • {{.}}
  • -{{/messageBodyItems}} -

    - {{/commits}} - - {{/issues}} -{{/tags}} -''', createFileTemplateFile: '', createFileUseTemplateContent: true, createFileUseTemplateFile: false, customIssues: [[link: '', name: '', pattern: '', title: ''], [link: '', name: '', pattern: '', title: '']], dateFormat: 'YYYY-MM-dd HH:mm:ss', file: 'CHANGELOG.md', fromReference: '', fromType: 'firstCommit', gitHubApi: '', gitHubApiTokenCredentialsId: '', gitHubIssuePattern: '#([0-9]+)', gitHubToken: '', gitLabApiTokenCredentialsId: '', gitLabProjectName: '', gitLabServer: '', gitLabToken: '', ignoreCommitsIfMessageMatches: '^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*|^Merge.*', ignoreCommitsWithoutIssue: false, ignoreTagsIfNameMatches: '', jiraIssuePattern: '\\b[a-zA-Z]([a-zA-Z]+)-([0-9]+)\\b', jiraPassword: '', jiraServer: '', jiraUsername: '', jiraUsernamePasswordCredentialsId: '', mediaWikiPassword: '', mediaWikiTemplateContent: '''__NOTOC__ - -= Git Changelog changelog = -Changelog of Git Changelog. - -{{#tags}} -== {{name}} == - {{#issues}} - {{#hasIssue}} - {{#hasLink}} -=== {{name}} [{{link}} {{issue}}] {{title}} === - {{/hasLink}} - {{^hasLink}} -=== {{name}} {{issue}} {{title}} === - {{/hasLink}} - {{/hasIssue}} - {{^hasIssue}} -=== {{name}} === - {{/hasIssue}} - - {{#commits}} -[https://gitlab.confdroid.com/12WW1160/git-changelog-lib/commit/{{hash}} {{hash}}] {{authorName}} {{commitTime}} - -\'\'\'{{{messageTitle}}}\'\'\' - -{{#messageBodyItems}} - * {{.}} -{{/messageBodyItems}} - - {{/commits}} - - {{/issues}} -{{/tags}} -''', mediaWikiTemplateFile: '', mediaWikiTitle: '', mediaWikiUrl: '', mediaWikiUseTemplateContent: false, mediaWikiUseTemplateFile: false, mediaWikiUsername: '', noIssueName: 'No issue', readableTagName: '/([^/]+?)$', showSummary: false, showSummaryTemplateContent: '''

    Git Changelog changelog

    - -

    -Changelog of Git Changelog. -

    - -{{#tags}} -

    {{name}}

    - {{#issues}} - {{#hasIssue}} - {{#hasLink}} -

    {{name}} {{issue}} {{title}}

    - {{/hasLink}} - {{^hasLink}} -

    {{name}} {{issue}} {{title}}

    - {{/hasLink}} - {{/hasIssue}} - {{^hasIssue}} -

    {{name}}

    - {{/hasIssue}} - - - {{#commits}} -{{hash}} {{authorName}} {{commitTime}} -

    -

    {{{messageTitle}}}

    - -{{#messageBodyItems}} -
  • {{.}}
  • -{{/messageBodyItems}} -

    - - - {{/commits}} - - {{/issues}} -{{/tags}} -''', showSummaryTemplateFile: '', showSummaryUseTemplateContent: false, showSummaryUseTemplateFile: false, subDirectory: '', timeZone: 'UTC', toReference: '', toType: 'master', untaggedName: 'Unreleased', useConfigFile: false, useFile: true, useGitHub: false, useGitHubApiTokenCredentials: false, useGitLab: false, useGitLabApiTokenCredentials: false, useIgnoreTagsIfNameMatches: false, useJira: false, useJiraUsernamePasswordCredentialsId: false, useMediaWiki: false, useReadableTagName: false, useSubDirectory: false]]) - - } - } - - stage('show diff') { - steps { - sh 'git diff' - } - } - - stage('recommit changes to repo') { + stage('update repo') { steps { sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) { sh '''git config user.name "Jenkins Server" @@ -198,31 +91,5 @@ Changelog of Git Changelog. } } } - - stage('update Gitlab') { - steps { - updateGitlabCommitStatus state: 'success' - } - } - } - - post { - always { - deleteDir() /* clean up our workspace */ - } - success { - echo 'Pipeline finished successfully!' - } - unstable { - echo 'I am unstable :/' - } - failure { - echo 'I failed :(' - step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true]) - } - changed { - echo 'Things were different before...' - mail bcc: '', body: "Pipeline Job '${JOB_NAME}' has changed, please verify.", cc: '', from: '', replyTo: '', subject: "Pipeline Job '${JOB_NAME}' has changed", to: 'support@confdroid.com' - } - } + } } diff --git a/README.md b/README.md index c3fb8c8..199c9bf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -|Repo Name| version | Build Status| -|---|---|---|---| -|`cd_selinux`| 0.0.1.1 | [![Build Status](https://pipelines.confdroid.com/buildStatus/icon?job=cd_selinux)](https://pipelines.confdroid.com/job/cd_selinux/)| +[![Build Status](https://pipelines.confdroid.com/buildStatus/icon?job=cd_selinux)](https://pipelines.confdroid.com/job/cd_selinux/) ### Synopsis [Security-Enhanced Linux (SELinux) is a Linux kernel security module that provides a mechanism for supporting access control security policies.](https://en.wikipedia.org/wiki/Security-Enhanced_Linux) @@ -12,7 +10,7 @@ ### Table of Contents * [Features](#features) -* [Repo Structure](https://gitlab.confdroid.com/12WW1160/cd_selinux/blob/master/REPOSTRUCTURE.md) +* [Repo Structure](https://sourcecode.confdroid.com/12WW1160/cd_selinux/blob/master/REPOSTRUCTURE.md) * [Dependencies](#dependencies) * [Deployment](#deployment) * [native Puppet deployment](#native-puppet-deployment) @@ -24,7 +22,6 @@ * [Known Problems](#known-problems) * [Support](#support) * [Tests](#tests) -* [Changelog](https://gitlab.confdroid.com/12WW1160/cd_selinux/blob/master/CHANGELOG.md) * [Contact Us](https://confdroid.com/contact/) * [Disclaimer](#disclaimer) @@ -45,7 +42,7 @@ Repostructure has moved to REPOSTRUCTURE.md in repo. ### Dependencies All dependencies must be included in the catalogue. -* [cd_resources](https://gitlab.confdroid.com/12WW1160/cd_resources) for yum repo resources. +* [cd_resources](https://sourcecode.confdroid.com/12WW1160/cd_resources) for yum repo resources. ### Deployment @@ -81,8 +78,8 @@ All files and directories are configured with correct selinux context. If selinu ### Support -* OS: CentOS 6, 7 -* Puppet 3.x +* OS: CentOS 7 +* Puppet 5.x ### Tests