safedb 0.10.5 → 0.10.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CONTRIBUTING.md +19 -0
- data/Dockerfile +26 -15
- data/Jenkinsfile +72 -9
- data/lib/controller/query/send.rb +28 -0
- data/lib/version.rb +1 -1
- data/pkg/README.md +4 -0
- data/{pod-image-builder.yaml → pod-image-build.yaml} +0 -0
- data/pod-image-release.yaml +36 -0
- data/{pod-image-safetty.yaml → pod-image-test.yaml} +3 -3
- metadata +8 -7
- data/cucumber-test.sh +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c67424b22f9a73d0be06e67f944d0d63773bfef5d55ef48bb2e1124c9020f476
|
4
|
+
data.tar.gz: 58c4f61eaa4bf72dda710ef7d235f9c09ff6e0021d02ec27afd9fe3d0c5b219b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c4818f807d171f57c195e5454d04c38bb0a22cdf5d13eeaf53ace02adea33caeafc82e9cb3316b37df28758dd81c5d46cb924f61b6bd2b68c74e0c08df8ac6c
|
7
|
+
data.tar.gz: 247b63933c58ae0e28ce709262f1662a7305950e7549db8cb390a0716d2fd51da9ca13468d87d58157f300c209e8b499600dca92462d1bd3ee23af11c242fb73
|
data/.gitignore
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -179,3 +179,22 @@ safedb.net has Dockerfiles through which the Cucumber/Aruba BDD (behaviour drive
|
|
179
179
|
### CI/CD Pipeline from Git to RubyGems.org
|
180
180
|
|
181
181
|
The Jenkinsfile template used is in the RubyGem category so succesful builds, quality inspection and tests result in a new version of the software being released to RubyGems.org
|
182
|
+
|
183
|
+
|
184
|
+
## Wiki Continuous Integration Pipeline
|
185
|
+
|
186
|
+
The continuous integration pipeline runs on top of a dockerized **Jenkins and Kubernetes platform** and if successful is deployed into a cloud production Kubernetes platform.
|
187
|
+
|
188
|
+
The pipeline steps defined in the Jenkinsfile are to
|
189
|
+
|
190
|
+
- skip the build if the commit message has skip ci in it from version number update
|
191
|
+
- use [Google Kaniko] to build this Dockerfile from this wiki base image
|
192
|
+
- push the Dockerfile with the latest tag to this Dockerhub repository
|
193
|
+
- create another pod to run the just-built devopswiki.co.uk image
|
194
|
+
- configure the container with a readiness probe so it does not receive traffic too early
|
195
|
+
- run a linkcheck activity using this Dockerhub linkcheck image (from this Github repo)
|
196
|
+
- if the linkchecking produces errors the pipeline fails and stops
|
197
|
+
- on success the devopswiki image is tagged with build number, Git commit ref and timestamp
|
198
|
+
- a kubectl rollout is issued based on the newly tagged devopswiki image
|
199
|
+
- change the standing start Kubernetes deployment configs to reflect the new tag
|
200
|
+
|
data/Dockerfile
CHANGED
@@ -13,34 +13,45 @@ RUN gem install gem-release cucumber aruba yard reek
|
|
13
13
|
# ---> orchestrate and validate command line behaviour.
|
14
14
|
# --->
|
15
15
|
|
16
|
-
RUN adduser --home /home/safeci --shell /bin/bash --gecos 'Safe TTY Test User' safeci && \
|
17
|
-
|
16
|
+
# --------------------------> RUN adduser --home /home/safeci --shell /bin/bash --gecos 'Safe TTY Test User' safeci && \
|
17
|
+
# --------------------------> install -d -m 755 -o safeci -g safeci /home/safeci
|
18
18
|
|
19
|
+
# --------------------------> RUN chown -R safeci:safeci /home/safeci
|
19
20
|
|
20
21
|
# --->
|
21
|
-
# --->
|
22
|
+
# --->
|
23
|
+
# ---> As the safeci user employ cucumber and aruba to recursively
|
24
|
+
# ---> find and execute all cucumber (*.feature) files under lib.
|
22
25
|
# --->
|
23
26
|
|
24
|
-
|
27
|
+
# --------------------------> USER safeci
|
28
|
+
# --------------------------> WORKDIR /home/safeci/code
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
25
33
|
|
34
|
+
# ----------------->
|
35
|
+
# ----------------->
|
36
|
+
# -----------------> The plan is to replace above safeci wity rubyist (chemist, scientist, dentist)
|
37
|
+
# -----------------> and let Dockerhub build the image as it is now global to ruby projects.
|
38
|
+
# ----------------->
|
39
|
+
# ----------------->
|
40
|
+
# ----------------->
|
26
41
|
|
27
42
|
# --->
|
28
|
-
# --->
|
43
|
+
# ---> Copy the project assets into the docker image.
|
29
44
|
# --->
|
30
45
|
|
31
|
-
|
32
|
-
chmod u+x /home/safeci/code/cucumber-test.sh && \
|
33
|
-
cd /home/safeci/code && \
|
34
|
-
rake install
|
46
|
+
# -----------------> COPY . /home/safeci/code/
|
35
47
|
|
36
48
|
|
37
49
|
# --->
|
38
|
-
# --->
|
39
|
-
# ---> As the safeci user employ cucumber and aruba to recursively
|
40
|
-
# ---> find and execute all cucumber (*.feature) files under lib.
|
50
|
+
# ---> Use rake to Copy the project assets into the docker image.
|
41
51
|
# --->
|
42
52
|
|
43
|
-
|
44
|
-
|
53
|
+
# -----------------> RUN chown -R safeci:safeci /home/safeci && \
|
54
|
+
# -----------------> cd /home/safeci/code && \
|
55
|
+
# -----------------> rake install
|
56
|
+
|
45
57
|
|
46
|
-
####### ENTRYPOINT [ "/home/safeci/code/cucumber-test.sh" ]
|
data/Jenkinsfile
CHANGED
@@ -3,6 +3,18 @@ pipeline
|
|
3
3
|
agent none
|
4
4
|
stages
|
5
5
|
{
|
6
|
+
/*
|
7
|
+
stage('Maybe Skip Build')
|
8
|
+
{
|
9
|
+
agent any
|
10
|
+
steps
|
11
|
+
{
|
12
|
+
scmSkip(deleteBuild: false, skipPattern:'.*\\[skip ci\\].*')
|
13
|
+
}
|
14
|
+
|
15
|
+
}
|
16
|
+
*/
|
17
|
+
/*
|
6
18
|
stage('Build Safe Docker Image')
|
7
19
|
{
|
8
20
|
agent
|
@@ -10,21 +22,18 @@ pipeline
|
|
10
22
|
kubernetes
|
11
23
|
{
|
12
24
|
defaultContainer 'kaniko'
|
13
|
-
yamlFile 'pod-image-
|
25
|
+
yamlFile 'pod-image-build.yaml'
|
14
26
|
}
|
15
27
|
}
|
16
28
|
steps
|
17
29
|
{
|
18
|
-
/*
|
19
|
-
* We checkout the git repository again because we
|
20
|
-
* are running in a different pod setup specifically
|
21
|
-
* to build and test the software.
|
22
|
-
*/
|
23
30
|
checkout scm
|
24
|
-
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --destination devops4me/
|
31
|
+
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --destination devops4me/haven:latest --cleanup'
|
25
32
|
}
|
26
33
|
}
|
27
|
-
|
34
|
+
*/
|
35
|
+
/*
|
36
|
+
stage('Reek Static Code Analysis')
|
28
37
|
{
|
29
38
|
agent
|
30
39
|
{
|
@@ -37,7 +46,61 @@ pipeline
|
|
37
46
|
{
|
38
47
|
container('safettytests')
|
39
48
|
{
|
40
|
-
sh '
|
49
|
+
sh 'reek lib || true'
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
*/
|
54
|
+
stage('Cucumber Aruba Tests')
|
55
|
+
{
|
56
|
+
agent
|
57
|
+
{
|
58
|
+
kubernetes
|
59
|
+
{
|
60
|
+
yamlFile 'pod-image-test.yaml'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
steps
|
64
|
+
{
|
65
|
+
container('safehaven')
|
66
|
+
{
|
67
|
+
checkout scm
|
68
|
+
sh 'rake install'
|
69
|
+
sh 'export SAFE_TTY_TOKEN=$(safe token) ; cucumber lib'
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
stage('Release to RubyGems.org')
|
74
|
+
{
|
75
|
+
agent
|
76
|
+
{
|
77
|
+
kubernetes
|
78
|
+
{
|
79
|
+
yamlFile 'pod-image-release.yaml'
|
80
|
+
}
|
81
|
+
}
|
82
|
+
when { environment name: 'GIT_BRANCH', value: 'origin/master' }
|
83
|
+
steps
|
84
|
+
{
|
85
|
+
container('safehaven')
|
86
|
+
{
|
87
|
+
checkout scm
|
88
|
+
sh 'git status'
|
89
|
+
sh 'git remote -v'
|
90
|
+
sh 'pwd'
|
91
|
+
sh 'ls -lah'
|
92
|
+
sh 'ls -lah $HOME/gitsshconfig'
|
93
|
+
sh 'ls -lah $HOME/gitsshkey'
|
94
|
+
sh 'cat $HOME/gitsshconfig/config'
|
95
|
+
sh 'mkdir -p $HOME/.ssh && cp $HOME/gitsshconfig/config $HOME/.ssh/config'
|
96
|
+
sh 'mkdir -p $HOME/.gem && cp $HOME/gemcredentials/credentials $HOME/.gem/credentials'
|
97
|
+
sh 'chmod 0600 $HOME/.gem/credentials'
|
98
|
+
sh 'git config --global user.email apolloakora@gmail.com'
|
99
|
+
sh 'git config --global user.name "Apollo Akora"'
|
100
|
+
sh 'ssh -i $HOME/gitsshkey/safedb.code.private.key.pem -vT git@safedb.code || true'
|
101
|
+
sh 'git remote set-url --push origin git@safedb.code:devops4me/safedb.net.git'
|
102
|
+
sh 'git branch && git checkout master'
|
103
|
+
sh 'gem bump minor --tag --release --file=$PWD/lib/version.rb'
|
41
104
|
}
|
42
105
|
}
|
43
106
|
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
module SafeDb
|
4
|
+
|
5
|
+
# The safe send command is used to transmit the contents of a book, chapter,
|
6
|
+
# verse or line using common messaging frameworks such as email, SMS and slack.
|
7
|
+
# Docker Secrets, HashiCorp's Vault and more besides.
|
8
|
+
#
|
9
|
+
# Navigate using `safe open` or `safe goto` to the chapter or verse that you
|
10
|
+
# wish to send and simply specify the message destination be it an email address
|
11
|
+
# or a mobile phone number.
|
12
|
+
#
|
13
|
+
# - `safe send colleague@example.com`
|
14
|
+
# - `safe send 07500765432`
|
15
|
+
#
|
16
|
+
# Visit documentation at https://www.safedb.net/docs/send
|
17
|
+
class Send < QueryVerse
|
18
|
+
|
19
|
+
def query_verse()
|
20
|
+
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
data/lib/version.rb
CHANGED
data/pkg/README.md
ADDED
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
metadata:
|
2
|
+
labels:
|
3
|
+
pod-type: jenkins-worker
|
4
|
+
spec:
|
5
|
+
containers:
|
6
|
+
- name: jnlp
|
7
|
+
env:
|
8
|
+
- name: CONTAINER_ENV_VAR
|
9
|
+
value: jnlp
|
10
|
+
- name: safehaven
|
11
|
+
image: devops4me/rubygem:latest
|
12
|
+
imagePullPolicy: Always
|
13
|
+
volumeMounts:
|
14
|
+
- name: gitsshconfig
|
15
|
+
mountPath: /root/gitsshconfig
|
16
|
+
- name: gitsshkey
|
17
|
+
mountPath: /root/gitsshkey
|
18
|
+
- name: gemcreds
|
19
|
+
mountPath: /root/gemcredentials
|
20
|
+
command:
|
21
|
+
- cat
|
22
|
+
tty: true
|
23
|
+
env:
|
24
|
+
- name: CONTAINER_ENV_VAR
|
25
|
+
value: safehaven
|
26
|
+
volumes:
|
27
|
+
- name: gitsshconfig
|
28
|
+
secret:
|
29
|
+
secretName: safegitsshconfig
|
30
|
+
- name: gitsshkey
|
31
|
+
secret:
|
32
|
+
secretName: safegitsshkey
|
33
|
+
defaultMode: 256
|
34
|
+
- name: gemcreds
|
35
|
+
secret:
|
36
|
+
secretName: saferubygemscreds
|
@@ -7,12 +7,12 @@ spec:
|
|
7
7
|
env:
|
8
8
|
- name: CONTAINER_ENV_VAR
|
9
9
|
value: jnlp
|
10
|
-
- name:
|
11
|
-
image: devops4me/
|
10
|
+
- name: safehaven
|
11
|
+
image: devops4me/rubygem:latest
|
12
12
|
imagePullPolicy: Always
|
13
13
|
command:
|
14
14
|
- cat
|
15
15
|
tty: true
|
16
16
|
env:
|
17
17
|
- name: CONTAINER_ENV_VAR
|
18
|
-
value:
|
18
|
+
value: safehaven
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safedb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apollo Akora
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|
@@ -101,7 +101,6 @@ files:
|
|
101
101
|
- README.md
|
102
102
|
- Rakefile
|
103
103
|
- bin/safe
|
104
|
-
- cucumber-test.sh
|
105
104
|
- lib/cli.rb
|
106
105
|
- lib/controller/abstract/authenticate.rb
|
107
106
|
- lib/controller/abstract/controller.rb
|
@@ -157,6 +156,7 @@ files:
|
|
157
156
|
- lib/controller/query/copy.rb
|
158
157
|
- lib/controller/query/print.rb
|
159
158
|
- lib/controller/query/publish.rb
|
159
|
+
- lib/controller/query/send.rb
|
160
160
|
- lib/controller/query/show.rb
|
161
161
|
- lib/controller/query/tell.rb
|
162
162
|
- lib/controller/requirer.rb
|
@@ -221,8 +221,10 @@ files:
|
|
221
221
|
- lib/utils/store/struct.rb
|
222
222
|
- lib/utils/time/timestamp.rb
|
223
223
|
- lib/version.rb
|
224
|
-
-
|
225
|
-
- pod-image-
|
224
|
+
- pkg/README.md
|
225
|
+
- pod-image-build.yaml
|
226
|
+
- pod-image-release.yaml
|
227
|
+
- pod-image-test.yaml
|
226
228
|
- safedb.gemspec
|
227
229
|
homepage: https://www.safedb.net
|
228
230
|
licenses:
|
@@ -244,8 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
246
|
- !ruby/object:Gem::Version
|
245
247
|
version: '0'
|
246
248
|
requirements: []
|
247
|
-
|
248
|
-
rubygems_version: 2.7.6
|
249
|
+
rubygems_version: 3.1.2
|
249
250
|
signing_key:
|
250
251
|
specification_version: 4
|
251
252
|
summary: safe locks and unlocks secrets in a simple, secure and intuitive way.
|
data/cucumber-test.sh
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
## ####################################### ##
|
4
|
-
## Exit this script when any command fails ##
|
5
|
-
## ####################################### ##
|
6
|
-
set -e
|
7
|
-
|
8
|
-
# ++ +++ ++++++ # +++++ +++++++ # +++ +++++++++ # +++++++ # ++++ +++++ ++ #
|
9
|
-
# ++ --- ------ # ----- ------- # --- --------- # ------- # ---- ----- ++ #
|
10
|
-
# ++ ++ #
|
11
|
-
# ++ Prepare for the cucumber orchestrated tests that are part of the ++ #
|
12
|
-
# ++ build for the safedb personal database. This script exports the ++ #
|
13
|
-
# ++ protective safe token and then executes cucumber feature files. ++ #
|
14
|
-
# ++ ++ #
|
15
|
-
# ++ --- ------ # ----- ------- # --- --------- # ------- # ---- ----- ++ #
|
16
|
-
# ++ +++ ++++++ # +++++ +++++++ # +++ +++++++++ # +++++++ # ++++ +++++ ++ #
|
17
|
-
|
18
|
-
echo "" ; echo "" ;
|
19
|
-
echo "### ######################################## ###"
|
20
|
-
echo "### Static Code Quality Analyzer Suggestions ###"
|
21
|
-
echo "### ######################################## ###"
|
22
|
-
echo ""
|
23
|
-
|
24
|
-
reek lib
|
25
|
-
echo ""
|
26
|
-
|
27
|
-
echo "" ; echo "" ;
|
28
|
-
echo "### ################################## ###"
|
29
|
-
echo "### Ruby Execution Environment Details ###"
|
30
|
-
echo "### ################################## ###"
|
31
|
-
echo ""
|
32
|
-
|
33
|
-
echo "Current directory is $(pwd)"
|
34
|
-
echo "Current username is $(whoami)"
|
35
|
-
echo "" ; ls -lh
|
36
|
-
safe version
|
37
|
-
|
38
|
-
echo ""
|
39
|
-
echo "### ################################ ###"
|
40
|
-
echo "### Exporting safe shell (tty) token ###"
|
41
|
-
echo "### ################################ ###"
|
42
|
-
echo ""
|
43
|
-
|
44
|
-
export SAFE_TTY_TOKEN=$(safe token)
|
45
|
-
|
46
|
-
echo "" ; echo "" ;
|
47
|
-
echo "### ###################################### ###"
|
48
|
-
echo "### Now executing the cucumber/aruba tests ###"
|
49
|
-
echo "### ###################################### ###"
|
50
|
-
echo ""
|
51
|
-
|
52
|
-
cucumber lib
|
53
|
-
echo ""
|
54
|
-
|
55
|
-
exit 0
|