From 8aa837f8e13d9d74b1678535104252356319eb72 Mon Sep 17 00:00:00 2001 From: 12WW1160 Date: Tue, 1 Dec 2020 17:54:26 +0100 Subject: [PATCH] update Jenkins- and Gemfile --- Gemfile | 5 +- Jenkinsfile | 171 +++++++--------------------------------------------- 2 files changed, 24 insertions(+), 152 deletions(-) diff --git a/Gemfile b/Gemfile index 2cfb945..e9584ba 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ 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' @@ -9,11 +9,12 @@ gem 'facter' gem 'rspec-puppet' gem 'yard' gem 'puppet-strings', '< 2.0.0' -gem 'rake' +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..7f4e60f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,14 +3,29 @@ 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 production') { steps { sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) { sh '''git config user.name "Jenkins Server" git config user.email jenkins@confdroid.com - git pull origin master + git pull origin production git checkout -b jenkins ''' } } @@ -53,7 +68,7 @@ pipeline { stage('compiler warnings') { steps { - warnings canComputeNew: false, canResolveRelativePaths: false, consoleParsers: [[parserName: 'Puppet-Lint']], defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: '' + scanForIssues tool: puppetLint() } } @@ -70,159 +85,15 @@ 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" git config user.email jenkins@confdroid.com echo `git add -A && git commit -am "recommit for updates in build $BUILD_NUMBER"` - git push origin HEAD:master''' + git push origin HEAD:production''' } } } - - 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' - } - } + } }