Skip to content

Commit faf4ad9

Browse files
Bot Updating Templated Files
1 parent 2e710ae commit faf4ad9

2 files changed

Lines changed: 53 additions & 12 deletions

File tree

‎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
@@ -59,8 +59,8 @@ Here are some example snippets to help you get started creating a container.
5959
```
6060
docker create \
6161
--name=nzbget \
62-
-e PUID=1001 \
63-
-e PGID=1001 \
62+
-e PUID=1000 \
63+
-e PGID=1000 \
6464
-e TZ=Europe/London \
6565
-p 6789:6789 \
6666
-v <path to data>:/config \
@@ -82,15 +82,14 @@ services:
8282
image: linuxserver/nzbget
8383
container_name: nzbget
8484
environment:
85-
- PUID=1001
86-
- PGID=1001
85+
- PUID=1000
86+
- PGID=1000
8787
- TZ=Europe/London
8888
volumes:
8989
- <path to data>:/config
9090
- <path/to/downloads>:/downloads
9191
ports:
9292
- 6789:6789
93-
mem_limit: 4096m
9493
restart: unless-stopped
9594
```
9695

@@ -101,8 +100,8 @@ Container images are configured using parameters passed at runtime (such as thos
101100
| Parameter | Function |
102101
| :----: | --- |
103102
| `-p 6789` | WebUI |
104-
| `-e PUID=1001` | for UserID - see below for explanation |
105-
| `-e PGID=1001` | for GroupID - see below for explanation |
103+
| `-e PUID=1000` | for UserID - see below for explanation |
104+
| `-e PGID=1000` | for GroupID - see below for explanation |
106105
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. |
107106
| `-v /config` | NZBGet App data. |
108107
| `-v /downloads` | Location of downloads on disk. |
@@ -113,11 +112,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
113112

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

116-
In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below:
115+
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
117116

118117
```
119118
$ id username
120-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
119+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
121120
```
122121

123122

@@ -169,9 +168,20 @@ Below are the instructions for updating containers:
169168
* Start the new container: `docker start nzbget`
170169
* You can also remove the old dangling images: `docker image prune`
171170

171+
### Via Taisun auto-updater (especially useful if you don't remember the original parameters)
172+
* Pull the latest image at its tag and replace it with the same env variables in one shot:
173+
```
174+
docker run --rm \
175+
-v /var/run/docker.sock:/var/run/docker.sock taisun/updater \
176+
--oneshot nzbget
177+
```
178+
* You can also remove the old dangling images: `docker image prune`
179+
172180
### Via Docker Compose
173-
* Update the image: `docker-compose pull linuxserver/nzbget`
174-
* Let compose update containers as necessary: `docker-compose up -d`
181+
* Update all images: `docker-compose pull`
182+
* or update a single image: `docker-compose pull nzbget`
183+
* Let compose update all containers as necessary: `docker-compose up -d`
184+
* or update a single container: `docker-compose up -d nzbget`
175185
* You can also remove the old dangling images: `docker image prune`
176186

177187
## Versions

0 commit comments

Comments
 (0)