Compare commits

..

21 Commits

Author SHA1 Message Date
bucky 10fe82ab6a Merge pull request 'archive-deliverable' (#26) from archive-deliverable into master
Reviewed-on: #26
2023-10-17 18:12:37 -07:00
Adam Townsend 9812a92d59 remove ls 2023-10-17 18:09:17 -07:00
Adam Townsend e8b12c307a include ruby version 2023-10-17 18:06:36 -07:00
Adam Townsend ae00ac8672 forgot the .rb 2023-10-17 18:04:29 -07:00
Adam Townsend bf92201721 removed some unnecessary lines, and check what's in the current
directory
2023-10-17 18:02:40 -07:00
Adam Townsend 1f2e3d41dd syntax error extra - in there 2023-10-17 18:00:46 -07:00
Adam Townsend f31b6da49c include the .env file and remove the scret.rb file 2023-10-17 17:58:40 -07:00
Adam Townsend f32d153b69 simplified things? 2023-10-17 17:46:24 -07:00
Adam Townsend 15d9ade2cf remove EXPORT 2023-10-17 17:42:17 -07:00
Adam Townsend 4587c35806 just set it in the script 2023-10-17 17:40:23 -07:00
Adam Townsend 340614dadc echo outside catch error 2023-10-17 17:37:35 -07:00
Adam Townsend 8a0fef63b2 another try 2023-10-17 17:35:37 -07:00
Adam Townsend 8691d19e8d dump the zip file, let's see how it's working? 2023-10-17 17:32:50 -07:00
Adam Townsend 35d196bdc2 another shot accessing the new env var 2023-10-17 17:28:41 -07:00
Adam Townsend e2c3cb7035 access the ZIP_FILE variable properly? 2023-10-17 17:25:02 -07:00
Adam Townsend a69b3e4226 missed quote 2023-10-17 17:22:00 -07:00
Adam Townsend 36285b060b better try to set the environment 2023-10-17 17:19:31 -07:00
Adam Townsend a0a9e84b91 another try 2023-10-17 17:14:33 -07:00
Adam Townsend 01d9f9a21c another shot at setting the zip file name 2023-10-17 17:12:16 -07:00
Adam Townsend 621a777a46 update env vars
+ removed the app session secret. it's used where it is set
+ added zip file to make it easier to name the zip and reuse the name
2023-10-17 17:05:15 -07:00
Adam Townsend 6fbecd78a4 clean out unnecessary files a little easier 2023-10-17 10:39:17 -07:00
1 changed files with 10 additions and 11 deletions

21
Jenkinsfile vendored
View File

@ -2,19 +2,14 @@ pipeline {
agent any
environment {
APP_SESSION_SECRET = ''
DB_NAME = 'url_shortener.db'
}
stages {
stage('Init') {
steps {
sh 'rbenv local 3.2.2'
script {
env.APP_SESSION_SECRET = sh(script: 'ruby secret.rb', returnStdout: true)
}
sh 'echo "ENV[\\\"APP_SESSION_SECRET\\\"] ||= $(ruby secret.rb)" > .env.rb'
sh 'echo "ENV[\\\"DB_NAME\\\"] ||= \\\"${DB_NAME}\\\"" >> .env.rb'
sh 'cat .env.rb'
}
}
stage('Build dependencies') {
@ -45,26 +40,30 @@ pipeline {
reportTitles: 'Cucumber Results, RSpec Results, Test Coverage'])
}
}
stage('Build deliverable') {
stage('Build production deliverable') {
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh ''' #!/usr/local/bin/bash
ZIP_FILE="url-shortener_$(date "+%Y-%m-%d_%H-%M-%S").tgz"
CUR_DIR=$(pwd)
mkdir -p /tmp/url-shortener
cp -R * /tmp/url-shortener
rm -rf /tmp/url-shortener/features /tmp/url-shortener/spec /tmp/url-shortener/coverage /tmp/url-shortener/db/*.db .git*
cp .env.rb /tmp/url-shortener/
cp .ruby-version /tmp/url-shortener/
cd /tmp/url-shortener
rm -rf features spec coverage db/*.db .git* Jenkinsfile *.html secret.rb
cd /tmp
tar -czvf url-shortener.tgz url-shortener/
mv url-shortener.tgz $CUR_DIR
tar -czvf $ZIP_FILE url-shortener/
mv /tmp/$ZIP_FILE $CUR_DIR/
'''
}
archiveArtifacts artifacts: 'url-shortener.tgz'
archiveArtifacts artifacts: '*.tgz'
}
}
stage('Clean up deliverable') {
steps {
sh 'rm -rf /tmp/url-shortener'
sh 'rm -rf url-shortener.tgz'
sh 'rm -rf *.tgz'
}
}
}