Compare commits

..

32 Commits

Author SHA1 Message Date
bucky 1822004460 use the hostname of the artifacts repository
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-19 07:58:59 -08:00
bucky b9345f9cb5 removed extra line
Gitea Bucky/url-shortener/pipeline/head This commit looks good
2023-12-18 20:19:55 -08:00
bucky 166c68570d v1.0.1
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 20:16:52 -08:00
bucky 28fc8b3b86 updated Gemfile with falcon instead of puma
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 20:15:33 -08:00
bucky 2c7a18c374 create the directory before syncingit
Gitea Bucky/url-shortener/pipeline/head This commit looks good
2023-12-18 18:38:18 -08:00
bucky 0a3f6c5fab try with ssh-agent
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 18:11:28 -08:00
bucky ca29051dc2 try to rsync with the user/key pair
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 17:50:42 -08:00
bucky 0b51b52b84 echo the file to see what's in there/how to handle it
Gitea Bucky/url-shortener/pipeline/head This commit looks good
2023-12-18 17:45:55 -08:00
bucky 4659942800 use user/key pair
Gitea Bucky/url-shortener/pipeline/head This commit looks good
2023-12-18 17:33:09 -08:00
bucky 6d0f594bba set file in the stage it is used in
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 17:15:30 -08:00
bucky 4ca73cc3ca use artifacts key
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 16:59:52 -08:00
bucky 1f96facbf2 use the ZIP FILE variable not ZIP_FILE text
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 15:57:02 -08:00
bucky e362cef9ba added SHA256 and sync both the sig and the zip
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 15:51:41 -08:00
bucky 25d94bbfc2 attempt to use rsync to sync data to artifact repo jail
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-12-18 13:09:52 -08:00
bucky 40e3703650 get the actual version, not the line
Gitea Bucky/url-shortener/pipeline/head This commit looks good
2023-10-24 18:11:12 -07:00
bucky 21eeb9db72 use version instead of date
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-10-24 18:01:15 -07:00
bucky 2cbe5f85b0 moved bundle-audit inside test group, added version file 2023-10-24 17:53:56 -07:00
bucky b62d45d0d8 Merge pull request 'prod-artifact-when-good' (#34) from prod-artifact-when-good into master
Gitea Bucky/url-shortener/pipeline/head This commit looks good
Reviewed-on: #34
2023-10-23 15:54:27 -07:00
bucky 0dc792b0bf added try catch wrappers around other parts. if they fail, don't build
Gitea Bucky/url-shortener/pipeline/head This commit looks good
the deliverable
2023-10-23 15:48:42 -07:00
bucky 5f4209dbe8 testing skipping building the artifact at the end (and cleanup of it)
Gitea Bucky/url-shortener/pipeline/head This commit looks good
2023-10-23 15:10:16 -07:00
bucky fbba67a9bd install, not clean, since it changed the bundle location
Gitea Bucky/url-shortener/pipeline/head This commit looks good
2023-10-23 15:05:20 -07:00
bucky 5cd296cb70 when is outside the steps
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-10-23 15:03:45 -07:00
bucky 7c0f6eb603 limit building deployment artifact
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
+ added buildArtifact variable and set it to true
+ in auditing stage, if there's an error, set buildArtifact to false
+ in build artifact stage, if buildArtifact is true, build  it
2023-10-23 14:58:02 -07:00
bucky de3dcc48ab removed the when, and removed unnecessary rm command
Gitea Bucky/url-shortener/pipeline/head There was a failure building this commit
2023-10-23 12:31:29 -07:00
bucky 958091e000 see if we can access the buildResult status to use it 2023-10-23 11:32:02 -07:00
bucky 35583e404e move the local path in the build prod artifact stage to make the tests
quicker
2023-10-23 07:43:30 -07:00
bucky 0e9342fab6 only build the production environment when the previous steps all executed successfully 2023-10-23 07:41:52 -07:00
bucky ca4182d798 Merge pull request 'added bundle config to only use prod gems and bundle clean to remove unnecessary gems from the current poject' (#33) from build-deployment-artifact into master
Reviewed-on: #33

closes bucky/url-shortener#32
2023-10-23 07:31:15 -07:00
bucky 7d04c46728 added bundle config to only use prod gems and bundle clean to remove unnecessary gems from the current poject 2023-10-23 07:18:31 -07:00
bucky 4490ed3e7c output something from the bundler audit to see in the reports 2023-10-22 16:22:18 -07:00
bucky 30c1192e27 Merge pull request 'audit' (#31) from audit into master
Reviewed-on: #31

closes bucky/url-shortener#30
2023-10-22 16:06:15 -07:00
bucky 6e30705810 rubocop autofixed quotes 2023-10-22 15:57:57 -07:00
4 changed files with 145 additions and 19 deletions
+5 -5
View File
@@ -2,10 +2,10 @@
source 'https://rubygems.org'
gem 'puma', '~> 6.4'
gem 'rackup', '~> 2.1'
gem 'falcon', '~> 0.42.3'
gem 'roda', '~> 3.72'
gem 'sequel', '~> 5.72'
@@ -29,7 +29,7 @@ group :test do
gem 'rubocop', require: false
gem "ruby_audit", "~> 2.2"
end
gem 'ruby_audit', '~> 2.2'
gem "bundle-audit", "~> 0.1.0"
gem 'bundle-audit', '~> 0.1.0'
end
+64 -4
View File
@@ -4,8 +4,31 @@ GEM
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
async (2.6.5)
console (~> 1.10)
fiber-annotation
io-event (~> 1.1)
timers (~> 4.1)
async-container (0.16.12)
async
async-io
async-http (0.61.0)
async (>= 1.25)
async-io (>= 1.28)
async-pool (>= 0.2)
protocol-http (~> 0.25.0)
protocol-http1 (~> 0.16.0)
protocol-http2 (~> 0.15.0)
traces (>= 0.10.0)
async-http-cache (0.4.3)
async-http (~> 0.56)
async-io (1.37.0)
async
async-pool (0.4.0)
async (>= 1.25)
base64 (0.1.1)
bigdecimal (3.1.4)
build-environment (1.13.0)
builder (3.2.4)
bundle-audit (0.1.0)
bundler-audit
@@ -21,6 +44,9 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
console (1.23.2)
fiber-annotation
fiber-local
cucumber (9.0.2)
builder (~> 3.2, >= 3.2.4)
cucumber-ci-environment (~> 9.2, >= 9.2.0)
@@ -48,24 +74,53 @@ GEM
diff-lcs (1.5.0)
docile (1.4.0)
erubi (1.12.0)
falcon (0.42.3)
async
async-container (~> 0.16.0)
async-http (~> 0.57)
async-http-cache (~> 0.4.0)
async-io (~> 1.22)
build-environment (~> 1.13)
bundler
localhost (~> 1.1)
openssl (~> 3.0)
process-metrics (~> 0.2.0)
protocol-rack (~> 0.1)
samovar (~> 2.1)
ffi (1.16.2)
fiber-annotation (0.2.0)
fiber-local (1.0.0)
io-event (1.3.3)
json (2.6.3)
language_server-protocol (3.17.0.3)
localhost (1.1.10)
mapping (1.1.1)
matrix (0.4.2)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
multi_test (1.1.0)
nio4r (2.5.9)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
openssl (3.2.0)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
process-metrics (0.2.1)
console (~> 1.8)
samovar (~> 2.1)
protocol-hpack (1.4.2)
protocol-http (0.25.0)
protocol-http1 (0.16.0)
protocol-http (~> 0.22)
protocol-http2 (0.15.1)
protocol-hpack (~> 1.4)
protocol-http (~> 0.18)
protocol-rack (0.2.6)
protocol-http (~> 0.23)
rack (>= 1.0)
public_suffix (5.0.3)
puma (6.4.0)
nio4r (~> 2.0)
racc (1.7.1)
rack (3.0.8)
rack-test (2.1.0)
@@ -109,6 +164,9 @@ GEM
ruby_audit (2.2.0)
bundler-audit (~> 0.9.0)
rubyzip (2.3.2)
samovar (2.2.0)
console (~> 1.0)
mapping (~> 1.0)
selenium-webdriver (4.13.1)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
@@ -127,6 +185,8 @@ GEM
ffi (~> 1.1)
thor (1.3.0)
tilt (2.3.0)
timers (4.3.5)
traces (0.11.1)
unicode-display_width (2.5.0)
webrick (1.8.1)
websocket (1.2.10)
@@ -141,7 +201,7 @@ DEPENDENCIES
capybara (~> 3.39)
cucumber (~> 9.0)
erubi (~> 1.12)
puma (~> 6.4)
falcon (~> 0.42.3)
rackup (~> 2.1)
roda (~> 3.72)
rspec (~> 3.12)
Vendored
+75 -10
View File
@@ -1,3 +1,5 @@
def buildArtifact = true
pipeline {
agent { label 'ruby && freebsd' }
@@ -18,7 +20,6 @@ pipeline {
}
stage('Build dependencies') {
steps {
sh 'bundle config set --local path "vendor"'
sh 'bundle install'
sh 'sequel -m db/migrations sqlite://db/${DB_NAME}'
}
@@ -26,25 +27,57 @@ pipeline {
stage('Audit Dependencies') {
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh 'bundle exec ruby-audit check'
sh 'bundle exec bundle-audit check'
script {
try {
sh 'bundle exec ruby-audit check'
sh 'bundle exec bundle-audit check >> audit.html'
} catch (e) {
script {
buildArtifact = false
}
}
}
}
}
}
stage('Code Linting') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'bundle exec rubocop --format html --out rubocop.html'
script {
try {
sh 'bundle exec rubocop --format html --out rubocop.html'
} catch (e) {
script {
buildArtifact = false
}
}
}
}
}
}
stage('Run tests') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'bundle exec cucumber features --format html --out cucumber.html'
script {
try {
sh 'bundle exec cucumber features --format html --out cucumber.html'
} catch (e) {
script {
buildArtifact = false
}
}
}
}
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'bundle exec rspec spec --format html --out spec.html'
script {
try {
sh 'bundle exec rspec spec --format html --out spec.html'
} catch (e) {
script {
buildArtifact = false
}
}
}
}
}
}
@@ -55,17 +88,25 @@ pipeline {
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: '.',
reportFiles: 'rubocop.html, cucumber.html, spec.html, coverage/index.html',
reportFiles: 'rubocop.html, audit.html, cucumber.html, spec.html, coverage/index.html',
reportName: 'Test Results',
reportTitles: 'Rubocop Results, Cucumber Results, RSpec Results, Test Coverage'])
reportTitles: 'Rubocop Results, Bundler Audit Results, Cucumber Results, RSpec Results, Test Coverage'])
}
}
stage('Build production deliverable') {
when {
expression {
buildArtifact
}
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh ''' #!/usr/local/bin/bash
ZIP_FILE="url-shortener_${BRANCH_NAME}_$(date "+%Y-%m-%d_%H-%M-%S").tgz"
ZIP_FILE="url-shortener_${BRANCH_NAME}_$(cat VERSION | cut -d"'" -f2).tgz"
CUR_DIR=$(pwd)
bundle config set --local without 'test'
bundle config set --local path "vendor"
bundle install
mkdir -p /tmp/url-shortener
cp -R * /tmp/url-shortener
cp .env.rb /tmp/url-shortener/
@@ -80,10 +121,34 @@ pipeline {
archiveArtifacts artifacts: '*.tgz'
}
}
stage('Generate SHA256 Hash and Upload to Artifact Repository') {
environment {
ARTIFACTS_KEY = credentials('artifactor-key')
}
steps {
sshagent(['artifactor-key']) {
sh ''' #!/usr/local/bin/bash
UUID=$(uuidgen -r)
VERSION=$(cat VERSION | cut -d"'" -f2)
BRANCH=${BRANCH_NAME}
ZIP_FILE="url-shortener_${BRANCH_NAME}_$(cat VERSION | cut -d"'" -f2).tgz"
sha256 $ZIP_FILE >> SHA256.sig
ssh artifactor@artifacts mkdir -p projects/url-shortener/$BRANCH/$VERSION/$UUID
rsync SHA256.sig artifactor@artifacts:projects/url-shortener/$BRANCH/$VERSION/$UUID/
rsync $ZIP_FILE artifactor@artifacts:projects/url-shortener/$BRANCH/$VERSION/$UUID/
'''
}
}
}
stage('Clean up deliverable') {
when {
expression {
buildArtifact
}
}
steps {
sh 'rm -rf /tmp/url-shortener'
sh 'rm -rf *.tgz'
sh 'rm SHA256.sig'
}
}
}
+1
View File
@@ -0,0 +1 @@
VERSION = '1.0.1'