diff --git a/.gitignore b/.gitignore index 3c02df3..cdab315 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,32 @@ Gemfile.lock FileList .scannerwork +.vscode +.idea +*.log +*.tmp +*.swp +*.swo +*.bak +*.backup +*.orig +*.rej +*.sublime-project +*.sublime-workspace +.DS_Store +Thumbs.db +*.gem +*.rbc +.bundle +vendor/bundle +vendor/cache +vendor/gems +vendor/ruby +log/* +tmp/* +!.keep +coverage/* +spec/reports/* +test/reports/* +doc/* +pkg/* diff --git a/Jenkinsfile b/Jenkinsfile index ade805c..c969e95 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,5 @@ pipeline { - agent { - label 'puppet' - } + agent any post { always { @@ -69,7 +67,7 @@ pipeline { withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) { sh ''' /opt/sonar-scanner/bin/sonar-scanner \ - -Dsonar.projectKey=php_cd \ + -Dsonar.projectKey=confdroid_php \ -Dsonar.sources=. \ -Dsonar.host.url=https://sonarqube.confdroid.com \ -Dsonar.token=$SONAR_TOKEN @@ -90,16 +88,36 @@ pipeline { sh ''' git config user.name "Jenkins Server" git config user.email jenkins@confdroid.com + git rm -r --cached .vscode || echo "No .vscode to remove from git" git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit" - git push -o merge_request.create \ - -o merge_request.target=master \ - -o merge_request.title="Auto-merge for build $BUILD_NUMBER" \ - -o merge_request.description="Automated changes from Jenkins build $BUILD_NUMBER" \ - -o merge_request.merge_when_pipeline_succeeds=true \ - origin jenkins-build-$BUILD_NUMBER + git push origin HEAD:master ''' } } } + stage('Mirror to Gitea') { + steps { + withCredentials([usernamePassword( + credentialsId: 'Jenkins-gitea', + usernameVariable: 'GITEA_USER', + passwordVariable: 'GITEA_TOKEN')]) { + script { + // Checkout from GitLab (already done implicitly) + sh ''' + git checkout master + git pull origin master + git branch -D development + git branch -D jenkins-build-$BUILD_NUMBER + git rm -f Jenkinsfile + git rm -r --cached .vscode || echo "No .vscode to remove from git" + git commit --amend --no-edit --allow-empty + git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_php.git + git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \ + push master --mirror + ''' + } + } + } + } } } \ No newline at end of file diff --git a/README.md b/README.md index 78048a7..1a77183 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Readme -[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=php_cd)](https://jenkins.confdroid.com/job/php_cd/)| +[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_php)](https://jenkins.confdroid.com/job/confdroid_php/)| [[_TOC_]] @@ -8,7 +8,7 @@ Php is a widely used open source scripting language for web services. -`php_cd` manages php installations for use with other modules like `wordpress_cd` +`confdroid_php` manages php installations for use with other modules like `wordpress_cd` ## WARNING diff --git a/manifests/init.pp b/manifests/init.pp index 214e6d2..b14d564 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,8 +1,8 @@ -## php_cd::init.pp -# Module name: php_cd -# Author: Arne Teuke (arne_teuke@confdroid.com) -# @summary Class initializes the php_cd module +## confdroid_php::init.pp +# Module name: confdroid_php +# Author: 12ww1160 (12ww1160@confdroid.com) +# @summary Class initializes the confdroid_php module ############################################################################## -class php_cd { - include php_cd::params +class confdroid_php { + include confdroid_php::params } diff --git a/manifests/main/config.pp b/manifests/main/config.pp index 842f130..94c318a 100644 --- a/manifests/main/config.pp +++ b/manifests/main/config.pp @@ -1,10 +1,10 @@ -## php_cd::main::config.pp -# Module name: php_cd -# Author: Arne Teuke (arne_teuke@confdroid.com) +## confdroid_php::main::config.pp +# Module name: confdroid_php +# Author: 12ww1160 (12ww1160@confdroid.com) # @summary Class manages the module logic ############################################################################## -class php_cd::main::config ( +class confdroid_php::main::config ( -) inherits php_cd::params { - include php_cd::main::files +) inherits confdroid_php::params { + include confdroid_php::main::files } diff --git a/manifests/main/dirs.pp b/manifests/main/dirs.pp index 5707b73..db6569b 100644 --- a/manifests/main/dirs.pp +++ b/manifests/main/dirs.pp @@ -1,12 +1,12 @@ -## php_cd::main::dirs.pp -# Module name: php_cd -# Author: Arne Teuke (arne_teuke@confdroid.com) +## confdroid_php::main::dirs.pp +# Module name: confdroid_php +# Author: 12ww1160 (12ww1160@confdroid.com) # @summary Class manages directory structure ############################################################################## -class php_cd::main::dirs ( +class confdroid_php::main::dirs ( -) inherits php_cd::params { - require php_cd::main::install +) inherits confdroid_php::params { + require confdroid_php::main::install file { $php_lib_dir: ensure => directory, diff --git a/manifests/main/files.pp b/manifests/main/files.pp index 090893d..5a689d1 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -1,12 +1,12 @@ -## php_cd::main::files.pp -# Module name: php_cd -# Author: Arne Teuke (arne_teuke@confdroid.com) +## confdroid_php::main::files.pp +# Module name: confdroid_php +# Author: 12ww1160 (12ww1160@confdroid.com) # @summary Class manages file aspects ############################################################################## -class php_cd::main::files ( +class confdroid_php::main::files ( -) inherits php_cd::params { - require php_cd::main::dirs +) inherits confdroid_php::params { + require confdroid_php::main::dirs file { $php_ini_file: ensure => file, diff --git a/manifests/main/install.pp b/manifests/main/install.pp index a8668be..6ce137d 100644 --- a/manifests/main/install.pp +++ b/manifests/main/install.pp @@ -1,11 +1,11 @@ -## php_cd::main::install.pp -# Module name: php_cd -# Author: Arne Teuke (arne_teuke@confdroid.com) +## confdroid_php::main::install.pp +# Module name: confdroid_php +# Author: 12ww1160 (12ww1160@confdroid.com) # @summary Class manages installation aspects ############################################################################## -class php_cd::main::install ( +class confdroid_php::main::install ( -) inherits php_cd::params { +) inherits confdroid_php::params { package { $reqpackages: ensure => $pkg_ensure, } diff --git a/manifests/params.pp b/manifests/params.pp index 5cb825b..4383e12 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,14 +1,14 @@ -## php_cd::params.pp -# Module name: php_cd -# Author: Arne Teuke (arne_teuke@confdroid.com) +## confdroid_php::params.pp +# Module name: confdroid_php +# Author: 12ww1160 (12ww1160@confdroid.com) # @summary Class contains all class parameters for this module # @param [String] reqpackages which packages to install # @param [String] pkg_ensure which version of packages to install ############################################################################## -class php_cd::params ( +class confdroid_php::params ( String $reqpackages = 'php', - String $pkg_ensure = 'latest', + String $pkg_ensure = 'present', ) { # Facts @@ -26,8 +26,8 @@ class php_cd::params ( # Files $php_ini_file = '/etc/php.ini' - $php_ini_erb = 'php_cd/php.ini.erb' + $php_ini_erb = 'confdroid_php/php.ini.erb' # includes must be last - include php_cd::main::config + include confdroid_php::main::config }