-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from wearefine/v2
Release v2.0.0
- Loading branch information
Showing
9 changed files
with
275 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
# puppet-jenkins-shared-libraries Changelog | ||
# Changelog | ||
|
||
## 1.0.0 | ||
All notable changes to this project will be documented in this file. | ||
|
||
- EVERYTHING :tada: | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | ||
|
||
## [v2.0.0] - 6-1-2018 | ||
|
||
### Added | ||
|
||
- Docker build support based on presence of a docker-compose.yml file | ||
- Docker build information | ||
|
||
### Updated | ||
|
||
- CHANGELOG format | ||
- Linted README markdown | ||
|
||
## [v1.0.0] | ||
|
||
- EVERYTHING :tada: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
node { | ||
try { | ||
stage('Volume Clean') { | ||
sh 'docker volume prune -f' | ||
} | ||
currentBuild.result = 'SUCCESS' | ||
} catch(Exception e) { | ||
currentBuild.result = 'FAILURE' | ||
slackSend channel: '#devops', failOnError: true, color: 'danger', message: 'Jenkins Docker cleanup run *FAILED*!' | ||
throw e | ||
} | ||
slackSend channel: '#devops', failOnError: true, color: 'good', message: 'Jenkins Docker cleanup run *SUCCESSFUL*!' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def call(Map config) { | ||
try { | ||
stage('Deploy') { | ||
milestone label: 'Deploy' | ||
|
||
if (config.DEPLOY_WITH_R10K == 'true') { | ||
try { | ||
stage('Deploy'){ | ||
milestone label: 'Deploy' | ||
def deploy_branch = config.R10K_DEPLOY_BRANCH.any {it == env.BRANCH_NAME} | ||
|
||
if (deploy_branch) { | ||
sh returnStdout: true, script: "curl --request POST -k --url ${config.R10K_DEPLOY_URL}/payload --header \'content-type: application/json\' ${config.BASIC_AUTH_HEADER} --data \'{\"push\":{\"changes\":[{\"new\":{\"name\":\"${env.BRANCH_NAME}\"}}]}}\'" | ||
|
||
currentBuild.result = 'SUCCESS' | ||
} | ||
} | ||
} catch(Exception e) { | ||
junit allowEmptyResults: true, keepLongStdio: true, testResults: "${config.TEST_RESULTS_DIR}/*.xml" | ||
currentBuild.result = 'FAILURE' | ||
if (config.DEBUG == 'false') { | ||
puppetSlack(config.SLACK_CHANNEL) | ||
} | ||
throw e | ||
} | ||
} | ||
|
||
currentBuild.result = 'SUCCESS' | ||
} | ||
} catch(Exception e) { | ||
currentBuild.result = 'FAILURE' | ||
if (config.DEBUG == 'false') { | ||
puppetSlack(config.SLACK_CHANNEL) | ||
} | ||
throw e | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def call(Map config) { | ||
if (!config.DOCKER_REGISTRY_CREDS_ID) { | ||
error 'DOCKER_REGISTRY_CREDS_ID is required to use Docker builds' | ||
} | ||
if (!config.DOCKER_REGISTRY_URL){ | ||
error 'DOCKER_REGISTRY_URL is required to use Docker builds' | ||
} | ||
if (!config.AWS_DEFAULT_REGION){ | ||
env.AWS_DEFAULT_REGION = 'us-west-2' | ||
} else { | ||
env.AWS_DEFAULT_REGION = config.AWS_DEFAULT_REGION | ||
} | ||
|
||
env.BRANCH_NAME = env.BRANCH_NAME.split('-')[0].toLowerCase() | ||
echo "BRANCH_NAME: ${env.BRANCH_NAME}" | ||
|
||
config.DOCKER_REGISTRY = config.DOCKER_REGISTRY_URL.split('https://')[1] | ||
env.REPO_NAME = env.JOB_NAME.split('/')[0] | ||
env.GEM_VOLUME = "${env.REPO_NAME}_${env.BRANCH_NAME}_gems" | ||
|
||
docker.withRegistry(config.DOCKER_REGISTRY_URL, "ecr:${env.AWS_DEFAULT_REGION}:${config.DOCKER_REGISTRY_CREDS_ID}") { | ||
|
||
config.container = "docker run -t --rm --name ${env.BUILD_TAG} -w /app -v ${env.WORKSPACE}:/app -v ${env.GEM_VOLUME}:/gems -e RAILS_ENV=${env.RAILS_ENV} ${config.DOCKER_REGISTRY}:${env.RUBY_VERSION}" | ||
|
||
puppetInstallDepsDocker(config) | ||
|
||
puppetTestsDocker(config) | ||
|
||
puppetDeployDocker(config) | ||
|
||
sh "${config.container} chown -R 1003:1004 /app" | ||
} // withRegistry | ||
} // top level function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env groovy | ||
|
||
def call(Map config) { | ||
try { | ||
stage('Install Dependancies') { | ||
milestone label: 'Install Dependancies' | ||
retry(2) { | ||
sh "${config.container} bundle install --quiet --clean --jobs=4" | ||
} | ||
currentBuild.result = 'SUCCESS' | ||
} | ||
} catch(Exception e) { | ||
currentBuild.result = 'FAILURE' | ||
if (config.DEBUG == 'false') { | ||
puppetSlack(config.SLACK_CHANNEL) | ||
} | ||
throw e | ||
} | ||
} |
Oops, something went wrong.