Skip to content

Commit d5b6065

Browse files
Bot Updating Templated Files
1 parent 9259e9b commit d5b6065

File tree

2 files changed

+53
-12
lines changed

2 files changed

+53
-12
lines changed

Diff for: Jenkinsfile

+32-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pipeline {
4343
script: '''curl -s https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases/latest | jq -r '. | .tag_name' ''',
4444
returnStdout: true).trim()
4545
env.LS_RELEASE_NOTES = sh(
46-
script: '''git log -1 --pretty=%B | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
46+
script: '''cat readme-vars.yml | awk -F \\" '/date: "[0-9][0-9].[0-9][0-9].[0-9][0-9]:/ {print $4;exit;}' | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
4747
returnStdout: true).trim()
4848
env.GITHUB_DATE = sh(
4949
script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''',
@@ -294,6 +294,9 @@ pipeline {
294294
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
295295
sh "docker tag ${IMAGE}:arm32v6-${META_TAG} lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
296296
sh "docker push lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
297+
sh '''docker rmi \
298+
${IMAGE}:arm32v6-${META_TAG} \
299+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} '''
297300
}
298301
}
299302
}
@@ -320,6 +323,9 @@ pipeline {
320323
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
321324
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
322325
sh "docker push lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
326+
sh '''docker rmi \
327+
${IMAGE}:arm64v8-${META_TAG} \
328+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
323329
}
324330
}
325331
}
@@ -481,6 +487,10 @@ pipeline {
481487
sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest"
482488
sh "docker push ${IMAGE}:latest"
483489
sh "docker push ${IMAGE}:${META_TAG}"
490+
sh '''docker rmi \
491+
${IMAGE}:${META_TAG} \
492+
${IMAGE}:latest '''
493+
484494
}
485495
}
486496
}
@@ -528,6 +538,15 @@ pipeline {
528538
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8"
529539
sh "docker manifest push --purge ${IMAGE}:latest"
530540
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
541+
sh '''docker rmi \
542+
${IMAGE}:amd64-${META_TAG} \
543+
${IMAGE}:amd64-latest \
544+
${IMAGE}:arm32v6-${META_TAG} \
545+
${IMAGE}:arm32v6-latest \
546+
${IMAGE}:arm64v8-${META_TAG} \
547+
${IMAGE}:arm64v8-latest \
548+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} \
549+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
531550
}
532551
}
533552
}
@@ -588,6 +607,18 @@ pipeline {
588607
}
589608
}
590609
}
610+
// If this is a Pull request send the CI link as a comment on it
611+
stage('Pull Request Comment') {
612+
when {
613+
not {environment name: 'CHANGE_ID', value: ''}
614+
environment name: 'CI', value: 'true'
615+
environment name: 'EXIT_STATUS', value: ''
616+
}
617+
steps {
618+
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
619+
-d '{"body": "I am a bot, here are the test results for this PR '${CI_URL}'"}' '''
620+
}
621+
}
591622
}
592623
/* ######################
593624
Send status to Discord

Diff for: README.md

+21-11
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ Here are some example snippets to help you get started creating a container.
5656
```
5757
docker create \
5858
--name=bookstack \
59-
-e PUID=1001 \
60-
-e PGID=1001 \
59+
-e PUID=1000 \
60+
-e PGID=1000 \
6161
-e DB_HOST=<yourdbhost> \
6262
-e DB_USER=<yourdbuser> \
6363
-e DB_PASS=<yourdbpass> \
@@ -82,8 +82,8 @@ services:
8282
image: linuxserver/bookstack
8383
container_name: bookstack
8484
environment:
85-
- PUID=1001
86-
- PGID=1001
85+
- PUID=1000
86+
- PGID=1000
8787
- DB_HOST=<yourdbhost>
8888
- DB_USER=<yourdbuser>
8989
- DB_PASS=<yourdbpass>
@@ -93,7 +93,6 @@ services:
9393
- <path to data>:/config
9494
ports:
9595
- 6875:80
96-
mem_limit: 4096m
9796
restart: unless-stopped
9897
```
9998

@@ -104,8 +103,8 @@ Container images are configured using parameters passed at runtime (such as thos
104103
| Parameter | Function |
105104
| :----: | --- |
106105
| `-p 80` | will map the container's port 80 to port 6875 on the host |
107-
| `-e PUID=1001` | for UserID - see below for explanation |
108-
| `-e PGID=1001` | for GroupID - see below for explanation |
106+
| `-e PUID=1000` | for UserID - see below for explanation |
107+
| `-e PGID=1000` | for GroupID - see below for explanation |
109108
| `-e DB_HOST=<yourdbhost>` | for specifying the database host |
110109
| `-e DB_USER=<yourdbuser>` | for specifying the database user |
111110
| `-e DB_PASS=<yourdbpass>` | for specifying the database password |
@@ -119,11 +118,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
119118

120119
Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.
121120

122-
In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below:
121+
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
123122

124123
```
125124
$ id username
126-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
125+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
127126
```
128127

129128

@@ -189,9 +188,20 @@ Below are the instructions for updating containers:
189188
* Start the new container: `docker start bookstack`
190189
* You can also remove the old dangling images: `docker image prune`
191190

191+
### Via Taisun auto-updater (especially useful if you don't remember the original parameters)
192+
* Pull the latest image at its tag and replace it with the same env variables in one shot:
193+
```
194+
docker run --rm \
195+
-v /var/run/docker.sock:/var/run/docker.sock taisun/updater \
196+
--oneshot bookstack
197+
```
198+
* You can also remove the old dangling images: `docker image prune`
199+
192200
### Via Docker Compose
193-
* Update the image: `docker-compose pull linuxserver/bookstack`
194-
* Let compose update containers as necessary: `docker-compose up -d`
201+
* Update all images: `docker-compose pull`
202+
* or update a single image: `docker-compose pull bookstack`
203+
* Let compose update all containers as necessary: `docker-compose up -d`
204+
* or update a single container: `docker-compose up -d bookstack`
195205
* You can also remove the old dangling images: `docker image prune`
196206

197207
## Versions

0 commit comments

Comments
 (0)