Skip to content

Commit 83086b9

Browse files
Bot Updating Templated Files
1 parent 6ceec49 commit 83086b9

File tree

2 files changed

+54
-13
lines changed

2 files changed

+54
-13
lines changed

Jenkinsfile

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pipeline {
4040
script: '''curl -s https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases/latest | jq -r '. | .tag_name' ''',
4141
returnStdout: true).trim()
4242
env.LS_RELEASE_NOTES = sh(
43-
script: '''git log -1 --pretty=%B | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
43+
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' ''',
4444
returnStdout: true).trim()
4545
env.GITHUB_DATE = sh(
4646
script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''',
@@ -284,6 +284,9 @@ pipeline {
284284
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
285285
sh "docker tag ${IMAGE}:arm32v6-${META_TAG} lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
286286
sh "docker push lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
287+
sh '''docker rmi \
288+
${IMAGE}:arm32v6-${META_TAG} \
289+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} '''
287290
}
288291
}
289292
}
@@ -310,6 +313,9 @@ pipeline {
310313
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
311314
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
312315
sh "docker push lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
316+
sh '''docker rmi \
317+
${IMAGE}:arm64v8-${META_TAG} \
318+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
313319
}
314320
}
315321
}
@@ -339,7 +345,7 @@ pipeline {
339345
chmod 777 /tmp/package_versions.txt'
340346
elif [ "${DIST_IMAGE}" == "ubuntu" ]; then
341347
docker run --rm --entrypoint '/bin/sh' -v ${TEMPDIR}:/tmp ${LOCAL_CONTAINER} -c '\
342-
apt list -qq --installed > /tmp/package_versions.txt && \
348+
apt list -qq --installed | cut -d" " -f1-2 > /tmp/package_versions.txt && \
343349
chmod 777 /tmp/package_versions.txt'
344350
fi
345351
NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
@@ -471,6 +477,10 @@ pipeline {
471477
sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest"
472478
sh "docker push ${IMAGE}:latest"
473479
sh "docker push ${IMAGE}:${META_TAG}"
480+
sh '''docker rmi \
481+
${IMAGE}:${META_TAG} \
482+
${IMAGE}:latest '''
483+
474484
}
475485
}
476486
}
@@ -518,6 +528,15 @@ pipeline {
518528
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8"
519529
sh "docker manifest push --purge ${IMAGE}:latest"
520530
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
531+
sh '''docker rmi \
532+
${IMAGE}:amd64-${META_TAG} \
533+
${IMAGE}:amd64-latest \
534+
${IMAGE}:arm32v6-${META_TAG} \
535+
${IMAGE}:arm32v6-latest \
536+
${IMAGE}:arm64v8-${META_TAG} \
537+
${IMAGE}:arm64v8-latest \
538+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} \
539+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
521540
}
522541
}
523542
}
@@ -578,6 +597,18 @@ pipeline {
578597
}
579598
}
580599
}
600+
// If this is a Pull request send the CI link as a comment on it
601+
stage('Pull Request Comment') {
602+
when {
603+
not {environment name: 'CHANGE_ID', value: ''}
604+
environment name: 'CI', value: 'true'
605+
environment name: 'EXIT_STATUS', value: ''
606+
}
607+
steps {
608+
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
609+
-d '{"body": "I am a bot, here are the test results for this PR '${CI_URL}'"}' '''
610+
}
611+
}
581612
}
582613
/* ######################
583614
Send status to Discord

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Here are some example snippets to help you get started creating a container.
5959
```
6060
docker create \
6161
--name=duplicati \
62-
-e PUID=1001 \
63-
-e PGID=1001 \
62+
-e PUID=1000 \
63+
-e PGID=1000 \
6464
-e TZ=Europe/London \
6565
-p 8200:8200 \
6666
-v </path/to/appdata/config>:/config \
@@ -83,16 +83,15 @@ services:
8383
image: linuxserver/duplicati
8484
container_name: duplicati
8585
environment:
86-
- PUID=1001
87-
- PGID=1001
86+
- PUID=1000
87+
- PGID=1000
8888
- TZ=Europe/London
8989
volumes:
9090
- </path/to/appdata/config>:/config
9191
- </path/to/backups>:/backups
9292
- </path/to/source>:/source
9393
ports:
9494
- 8200:8200
95-
mem_limit: 4096m
9695
restart: unless-stopped
9796
```
9897

@@ -103,8 +102,8 @@ Container images are configured using parameters passed at runtime (such as thos
103102
| Parameter | Function |
104103
| :----: | --- |
105104
| `-p 8200` | http gui |
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
| `-v /config` | Contains all relevant configuration files. |
110109
| `-v /backups` | Path to store local backups. |
@@ -116,11 +115,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
116115

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

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

121120
```
122121
$ id username
123-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
122+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
124123
```
125124

126125

@@ -154,9 +153,20 @@ Below are the instructions for updating containers:
154153
* Start the new container: `docker start duplicati`
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 duplicati
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/duplicati`
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 duplicati`
168+
* Let compose update all containers as necessary: `docker-compose up -d`
169+
* or update a single container: `docker-compose up -d duplicati`
160170
* You can also remove the old dangling images: `docker image prune`
161171

162172
## Versions

0 commit comments

Comments
 (0)