Skip to content

Commit 7815b23

Browse files
Merge pull request #40 from strongbox/sb-against-sb
Updating guide for how to build Strongbox using a Strongbox instance
2 parents e998a2d + 645ea0a commit 7815b23

File tree

7 files changed

+181
-191
lines changed

7 files changed

+181
-191
lines changed

Jenkinsfile

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ def notifyBranch = [recipients: [brokenTestsSuspects(), requestor()]]
77
pipeline {
88
agent {
99
node {
10-
label 'alpine:mkdocs'
11-
customWorkspace workspace().getUniqueWorkspacePath()
10+
label 'alpine-mkdocs'
1211
}
1312
}
1413
environment {
@@ -21,14 +20,18 @@ pipeline {
2120
stage('Node')
2221
{
2322
steps {
24-
nodeInfo("python pip mkdocs")
23+
container("mkdocs") {
24+
nodeInfo("python pip mkdocs")
25+
}
2526
}
2627
}
2728
stage('Building')
2829
{
2930
steps {
30-
withCredentials([string(credentialsId: '3ea1e18a-b1d1-44e0-a1ff-7b62870913f8', variable: 'GOOGLE_ANALYTICS_KEY')]) {
31-
sh "mkdocs build"
31+
container("mkdocs") {
32+
withCredentials([string(credentialsId: '3ea1e18a-b1d1-44e0-a1ff-7b62870913f8', variable: 'GOOGLE_ANALYTICS_KEY')]) {
33+
sh "mkdocs build"
34+
}
3235
}
3336
}
3437
}
@@ -37,21 +40,16 @@ pipeline {
3740
expression { BRANCH_NAME == 'master' && (currentBuild.result == null || currentBuild.result == 'SUCCESS') }
3841
}
3942
steps {
40-
configFileProvider([configFile(fileId: 'e0235d92-c2fc-4f81-ae4b-28943ed7350d', targetLocation: '/tmp/gh-pages.sh')]) {
41-
withCredentials([sshUserPrivateKey(credentialsId: '011f2a7d-2c94-48f5-92b9-c07fd817b4be', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
42-
withEnv(["GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o User=${SSH_USER} -i ${SSH_KEY}"]) {
43-
sh "/bin/bash /tmp/gh-pages.sh"
43+
container("mkdocs") {
44+
configFileProvider([configFile(fileId: 'e0235d92-c2fc-4f81-ae4b-28943ed7350d', targetLocation: '/tmp/gh-pages.sh')]) {
45+
withCredentials([sshUserPrivateKey(credentialsId: '011f2a7d-2c94-48f5-92b9-c07fd817b4be', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
46+
withEnv(["GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o User=${SSH_USER} -i ${SSH_KEY}"]) {
47+
sh "/bin/bash /tmp/gh-pages.sh"
48+
}
4449
}
4550
}
4651
}
4752
}
4853
}
4954
}
50-
post {
51-
cleanup {
52-
script {
53-
workspace().clean()
54-
}
55-
}
56-
}
5755
}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3'
22
services:
33
mkdocs:
4-
image: strongboxci/alpine:mkdocs-4.0
4+
image: strongboxci/alpine:mkdocs-4.4
55
volumes:
66
- ./:/docs
77
ports:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings>
3+
4+
<localRepository>.m2/repository-strongbox-local</localRepository>
5+
6+
<mirrors>
7+
<mirror>
8+
<id>strongbox</id>
9+
<name>strongbox</name>
10+
<url>http://localhost:48080/storages/public/maven-group/</url>
11+
<mirrorOf>*</mirrorOf>
12+
</mirror>
13+
</mirrors>
14+
15+
<profiles>
16+
<profile>
17+
<id>carlspring-repositories</id>
18+
19+
<activation>
20+
<activeByDefault>true</activeByDefault>
21+
</activation>
22+
23+
<repositories>
24+
<repository>
25+
<id>strongbox</id>
26+
<name>strongbox</name>
27+
<url>http://localhost:48080/storages/public/maven-group/</url>
28+
<layout>default</layout>
29+
</repository>
30+
</repositories>
31+
<pluginRepositories>
32+
<pluginRepository>
33+
<id>strongbox</id>
34+
<name>strongbox</name>
35+
<url>http://localhost:48080/storages/public/maven-group/</url>
36+
<layout>default</layout>
37+
</pluginRepository>
38+
</pluginRepositories>
39+
</profile>
40+
</profiles>
41+
42+
<servers>
43+
<server>
44+
<id>releases</id>
45+
<username>admin</username>
46+
<password>password</password>
47+
</server>
48+
<server>
49+
<id>snapshots</id>
50+
<username>admin</username>
51+
<password>password</password>
52+
</server>
53+
</servers>
54+
</settings>

docs/developer-guide/building-strongbox-against-strongbox.md

Lines changed: 0 additions & 170 deletions
This file was deleted.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{% set localSettingsXml = "~/.m2/settings-local.xml" %}
2+
3+
# Building Strongbox using a Strongbox Instance
4+
5+
We like our dog food and we try it all the time! :smiley:
6+
7+
Working on Strongbox features is fun, but has a hidden issue - you can unintentionally break things.
8+
The best way to know if your changes are not affecting Strongbox is by testing it in a real-world environment.
9+
Building @strongbox/strongbox using a Strongbox instance is as "real world" environment as it can get and this
10+
article goes into details how to do the testing.
11+
12+
## Starting a Strongbox Instance
13+
14+
Before you start testing, you will need to have a running Strongbox instance.
15+
16+
You can start Strongbox in two ways - via `spring-boot` and from `strongbox-distribution`. In most cases, during the
17+
development phase you will mainly start an instance via `spring-boot`. However once you are done with your task you
18+
should always ensure the `strongbox-distribution` package works as expected.
19+
20+
``` linenums="1" tab="Strongbox via spring-boot"
21+
git clone {{repo_url}}
22+
mvn clean install -DskipTests
23+
cd strongbox-web-core
24+
mvn spring-boot:run
25+
```
26+
27+
``` linenums="1" tab="Strongbox from strongbox-distribution"
28+
git clone {{repo_url}}
29+
mvn clean install -DskipTests
30+
cd strongbox-distribution/target
31+
tar -zxf *gz
32+
cd strongbox-distribution-*/strongbox-*/
33+
./bin/strongbox console
34+
```
35+
36+
## Building and Deploying using Strongbox
37+
38+
Following the steps below should result in successful result:
39+
40+
1. [Did you pay attention?][Strongbox Instance]
41+
2. Configure your `settings.xml` to point to the local [Strongbox Instance]:
42+
43+
``` tab="Download"
44+
# Linux / MacOS
45+
curl -o {{localSettingsXml}} \
46+
{{resources}}/maven/settings-local.xml
47+
48+
# Windows
49+
curl -o %HOMEPATH%\.m2\settings-local.xml ^
50+
{{resources}}/maven/settings-local.xml
51+
```
52+
53+
``` tab="Raw/Copy"
54+
--8<-- "{{resourcesPath}}/maven/settings-local.xml"
55+
```
56+
57+
3. Make a clean clone of @strongbox/strongbox into a separate path (i.e. `strongbox-tmp`)
58+
4. Build Strongbox using a Strongbox instance:
59+
```
60+
$ cd strongbox-tmp
61+
$ mvn clean install -DskipTests -s {{localSettingsXml}}
62+
... (should start downloading artifacts from localhost:48080
63+
[INFO] Scanning for projects...
64+
Downloading from strongbox: http://localhost:48080/storages/public/maven-group/org/carlspring/strongbox/strongbox-parent/1.0-SNAPSHOT/maven-metadata.xml
65+
Downloaded from strongbox: http://localhost:48080/storages/public/maven-group/org/carlspring/strongbox/strongbox-parent/1.0-SNAPSHOT/maven-metadata.xml (617 B at 1.7 kB/s)
66+
...
67+
[INFO] ------------------------------------------------------------------------
68+
[INFO] BUILD SUCCESS
69+
[INFO] ------------------------------------------------------------------------
70+
```
71+
72+
5. Deploy into Strongbox
73+
```
74+
$ mvn clean deploy \
75+
-s {{localSettingsXml}}
76+
-DaltDeploymentRepository=snapshots::default::http://localhost:48080/storages/storage0/snapshots/ \
77+
-DskipTests \
78+
-fn
79+
80+
...
81+
[INFO] --- maven-install-plugin:2.4:install (default-install) @ strongbox-masterbuild ---
82+
[INFO] Installing /java/strongbox-tmp/pom.xml to /java/strongbox-tmp/.m2/repository-strongbox-local/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/strongbox-masterbuild-1.0-SNAPSHOT.pom
83+
[INFO]
84+
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ strongbox-masterbuild ---
85+
[INFO] Using alternate deployment repository snapshots::default::http://localhost:48080/storages/storage0/snapshots/
86+
Downloading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/maven-metadata.xml
87+
Uploading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/strongbox-masterbuild-1.0-20180128.060409-1.pom
88+
Uploaded: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/strongbox-masterbuild-1.0-20180128.060409-1.pom (4 KB at 5.6 KB/sec)
89+
Downloading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/maven-metadata.xml
90+
Uploading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/maven-metadata.xml
91+
Uploaded: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/1.0-SNAPSHOT/maven-metadata.xml (618 B at 1.2 KB/sec)
92+
Uploading: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/maven-metadata.xml
93+
Uploaded: http://localhost:48080/storages/storage0/snapshots/org/carlspring/strongbox/strongbox-masterbuild/maven-metadata.xml (303 B at 0.6 KB/sec)
94+
...
95+
[INFO] ------------------------------------------------------------------------
96+
[INFO] BUILD SUCCESS
97+
[INFO] ------------------------------------------------------------------------
98+
```
99+
100+
<!-- links -->
101+
[Strongbox Instance]: #starting-a-strongbox-instance

0 commit comments

Comments
 (0)