Skip to content

Commit c2544b0

Browse files
Bot Updating Templated Files
1 parent da795fb commit c2544b0

File tree

2 files changed

+53
-12
lines changed

2 files changed

+53
-12
lines changed

Jenkinsfile

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pipeline {
4141
script: '''curl -s https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases/latest | jq -r '. | .tag_name' ''',
4242
returnStdout: true).trim()
4343
env.LS_RELEASE_NOTES = sh(
44-
script: '''git log -1 --pretty=%B | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
44+
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' ''',
4545
returnStdout: true).trim()
4646
env.GITHUB_DATE = sh(
4747
script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''',
@@ -292,6 +292,9 @@ pipeline {
292292
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
293293
sh "docker tag ${IMAGE}:arm32v6-${META_TAG} lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
294294
sh "docker push lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
295+
sh '''docker rmi \
296+
${IMAGE}:arm32v6-${META_TAG} \
297+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} '''
295298
}
296299
}
297300
}
@@ -318,6 +321,9 @@ pipeline {
318321
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
319322
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
320323
sh "docker push lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
324+
sh '''docker rmi \
325+
${IMAGE}:arm64v8-${META_TAG} \
326+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
321327
}
322328
}
323329
}
@@ -479,6 +485,10 @@ pipeline {
479485
sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest"
480486
sh "docker push ${IMAGE}:latest"
481487
sh "docker push ${IMAGE}:${META_TAG}"
488+
sh '''docker rmi \
489+
${IMAGE}:${META_TAG} \
490+
${IMAGE}:latest '''
491+
482492
}
483493
}
484494
}
@@ -526,6 +536,15 @@ pipeline {
526536
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8"
527537
sh "docker manifest push --purge ${IMAGE}:latest"
528538
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
539+
sh '''docker rmi \
540+
${IMAGE}:amd64-${META_TAG} \
541+
${IMAGE}:amd64-latest \
542+
${IMAGE}:arm32v6-${META_TAG} \
543+
${IMAGE}:arm32v6-latest \
544+
${IMAGE}:arm64v8-${META_TAG} \
545+
${IMAGE}:arm64v8-latest \
546+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} \
547+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
529548
}
530549
}
531550
}
@@ -586,6 +605,18 @@ pipeline {
586605
}
587606
}
588607
}
608+
// If this is a Pull request send the CI link as a comment on it
609+
stage('Pull Request Comment') {
610+
when {
611+
not {environment name: 'CHANGE_ID', value: ''}
612+
environment name: 'CI', value: 'true'
613+
environment name: 'EXIT_STATUS', value: ''
614+
}
615+
steps {
616+
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
617+
-d '{"body": "I am a bot, here are the test results for this PR '${CI_URL}'"}' '''
618+
}
619+
}
589620
}
590621
/* ######################
591622
Send status to Discord

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Here are some example snippets to help you get started creating a container.
5151
```
5252
docker create \
5353
--name=syncthing \
54-
-e PUID=1001 \
55-
-e PGID=1001 \
54+
-e PUID=1000 \
55+
-e PGID=1000 \
5656
-e TZ=Europe/London \
5757
-e UMASK_SET=<022> \
5858
-p 8384:8384 \
@@ -78,8 +78,8 @@ services:
7878
image: linuxserver/syncthing
7979
container_name: syncthing
8080
environment:
81-
- PUID=1001
82-
- PGID=1001
81+
- PUID=1000
82+
- PGID=1000
8383
- TZ=Europe/London
8484
- UMASK_SET=<022>
8585
volumes:
@@ -90,7 +90,6 @@ services:
9090
- 8384:8384
9191
- 22000:22000
9292
- 21027/udp:21027/udp
93-
mem_limit: 4096m
9493
restart: unless-stopped
9594
```
9695

@@ -103,8 +102,8 @@ Container images are configured using parameters passed at runtime (such as thos
103102
| `-p 8384` | Application WebUI |
104103
| `-p 22000` | Listening port |
105104
| `-p 21027/udp` | Protocol discovery |
106-
| `-e PUID=1001` | for UserID - see below for explanation |
107-
| `-e PGID=1001` | for GroupID - see below for explanation |
105+
| `-e PUID=1000` | for UserID - see below for explanation |
106+
| `-e PGID=1000` | for GroupID - see below for explanation |
108107
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. |
109108
| `-e UMASK_SET=<022>` | Umask setting - [explaination](https://askubuntu.com/questions/44542/what-is-umask-and-how-does-it-work) |
110109
| `-v /config` | Configuration files. |
@@ -117,11 +116,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
117116

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

120-
In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below:
119+
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
121120

122121
```
123122
$ id username
124-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
123+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
125124
```
126125

127126

@@ -154,9 +153,20 @@ Below are the instructions for updating containers:
154153
* Start the new container: `docker start syncthing`
155154
* You can also remove the old dangling images: `docker image prune`
156155

156+
### Via Taisun auto-updater (especially useful if you don't remember the original parameters)
157+
* Pull the latest image at its tag and replace it with the same env variables in one shot:
158+
```
159+
docker run --rm \
160+
-v /var/run/docker.sock:/var/run/docker.sock taisun/updater \
161+
--oneshot syncthing
162+
```
163+
* You can also remove the old dangling images: `docker image prune`
164+
157165
### Via Docker Compose
158-
* Update the image: `docker-compose pull linuxserver/syncthing`
159-
* Let compose update containers as necessary: `docker-compose up -d`
166+
* Update all images: `docker-compose pull`
167+
* or update a single image: `docker-compose pull syncthing`
168+
* Let compose update all containers as necessary: `docker-compose up -d`
169+
* or update a single container: `docker-compose up -d syncthing`
160170
* You can also remove the old dangling images: `docker image prune`
161171

162172
## Versions

0 commit comments

Comments
 (0)