Skip to content

Commit 5c0e30b

Browse files
Bot Updating Templated Files
1 parent 00e337f commit 5c0e30b

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 | jq -r 'first(.[] | select(.prerelease == true)) | .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}:development"
472478
sh "docker push ${IMAGE}:development"
473479
sh "docker push ${IMAGE}:${META_TAG}"
480+
sh '''docker rmi \
481+
${IMAGE}:${META_TAG} \
482+
${IMAGE}:development '''
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}:development"
520530
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
531+
sh '''docker rmi \
532+
${IMAGE}:amd64-${META_TAG} \
533+
${IMAGE}:amd64-development \
534+
${IMAGE}:arm32v6-${META_TAG} \
535+
${IMAGE}:arm32v6-development \
536+
${IMAGE}:arm64v8-${META_TAG} \
537+
${IMAGE}:arm64v8-development \
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
@@ -51,8 +51,8 @@ Here are some example snippets to help you get started creating a container.
5151
```
5252
docker create \
5353
--name=duplicati \
54-
-e PUID=1001 \
55-
-e PGID=1001 \
54+
-e PUID=1000 \
55+
-e PGID=1000 \
5656
-e TZ=Europe/London \
5757
-p 8200:8200 \
5858
-v </path/to/appdata/config>:/config \
@@ -75,16 +75,15 @@ services:
7575
image: linuxserver/duplicati
7676
container_name: duplicati
7777
environment:
78-
- PUID=1001
79-
- PGID=1001
78+
- PUID=1000
79+
- PGID=1000
8080
- TZ=Europe/London
8181
volumes:
8282
- </path/to/appdata/config>:/config
8383
- </path/to/backups>:/backups
8484
- </path/to/source>:/source
8585
ports:
8686
- 8200:8200
87-
mem_limit: 4096m
8887
restart: unless-stopped
8988
```
9089

@@ -95,8 +94,8 @@ Container images are configured using parameters passed at runtime (such as thos
9594
| Parameter | Function |
9695
| :----: | --- |
9796
| `-p 8200` | http gui |
98-
| `-e PUID=1001` | for UserID - see below for explanation |
99-
| `-e PGID=1001` | for GroupID - see below for explanation |
97+
| `-e PUID=1000` | for UserID - see below for explanation |
98+
| `-e PGID=1000` | for GroupID - see below for explanation |
10099
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London |
101100
| `-v /config` | Contains all relevant configuration files. |
102101
| `-v /backups` | Path to store local backups. |
@@ -108,11 +107,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
108107

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

111-
In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below:
110+
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
112111

113112
```
114113
$ id username
115-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
114+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
116115
```
117116

118117

@@ -146,9 +145,20 @@ Below are the instructions for updating containers:
146145
* Start the new container: `docker start duplicati`
147146
* You can also remove the old dangling images: `docker image prune`
148147

148+
### Via Taisun auto-updater (especially useful if you don't remember the original parameters)
149+
* Pull the latest image at its tag and replace it with the same env variables in one shot:
150+
```
151+
docker run --rm \
152+
-v /var/run/docker.sock:/var/run/docker.sock taisun/updater \
153+
--oneshot duplicati
154+
```
155+
* You can also remove the old dangling images: `docker image prune`
156+
149157
### Via Docker Compose
150-
* Update the image: `docker-compose pull linuxserver/duplicati`
151-
* Let compose update containers as necessary: `docker-compose up -d`
158+
* Update all images: `docker-compose pull`
159+
* or update a single image: `docker-compose pull duplicati`
160+
* Let compose update all containers as necessary: `docker-compose up -d`
161+
* or update a single container: `docker-compose up -d duplicati`
152162
* You can also remove the old dangling images: `docker image prune`
153163

154164
## Versions

0 commit comments

Comments
 (0)