Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create libtorrentv1 tag #207

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Initial build
  • Loading branch information
thespad committed Aug 26, 2024
commit 37df4692341894753602417a567bcf42a8442b2b
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
## Readme

If you would like to change our readme, please __**do not**__ directly edit the readme, as it is auto-generated on each commit.
Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-deluge/edit/master/readme-vars.yml).
Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-deluge/edit/libtorrentv1/readme-vars.yml).

These variables are used in a template for our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) as part of an ansible play.
Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-deluge)
Expand Down Expand Up @@ -115,7 +115,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Update the changelog

If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-deluge/tree/master/root), add an entry to the changelog
If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-deluge/tree/libtorrentv1/root), add an entry to the changelog

```yml
changelogs:
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

------------------------------

- [ ] I have read the [contributing](https://github.com/linuxserver/docker-deluge/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications
- [ ] I have read the [contributing](https://github.com/linuxserver/docker-deluge/blob/libtorrentv1/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications

------------------------------

Expand Down
34 changes: 13 additions & 21 deletions .github/workflows/external_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@ on:
workflow_dispatch:

jobs:
external-trigger-master:
external-trigger-libtorrentv1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1

- name: External Trigger
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/libtorrentv1'
run: |
printf "# External trigger for docker-deluge\n\n" >> $GITHUB_STEP_SUMMARY
if [ -n "${{ secrets.PAUSE_EXTERNAL_TRIGGER_DELUGE_MASTER }}" ]; then
if [ -n "${{ secrets.PAUSE_EXTERNAL_TRIGGER_DELUGE_LIBTORRENTV1 }}" ]; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "> Github secret \`PAUSE_EXTERNAL_TRIGGER_DELUGE_MASTER\` is set; skipping trigger." >> $GITHUB_STEP_SUMMARY
echo "> Github secret \`PAUSE_EXTERNAL_TRIGGER_DELUGE_LIBTORRENTV1\` is set; skipping trigger." >> $GITHUB_STEP_SUMMARY
exit 0
fi
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
echo "> External trigger running off of master branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_DELUGE_MASTER\`" >> $GITHUB_STEP_SUMMARY
echo "> External trigger running off of libtorrentv1 branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_DELUGE_LIBTORRENTV1\`" >> $GITHUB_STEP_SUMMARY
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
&& awk '/^P:'"deluge"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://')
echo "Type is \`alpine_repo\`" >> $GITHUB_STEP_SUMMARY
EXT_RELEASE=$(curl -sL "https://pypi.python.org/pypi/deluge/json" |jq -r '. | .info.version')
echo "Type is \`pip_version\`" >> $GITHUB_STEP_SUMMARY
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "> Can't retrieve external version, exiting" >> $GITHUB_STEP_SUMMARY
FAILURE_REASON="Can't retrieve external version for deluge branch master"
FAILURE_REASON="Can't retrieve external version for deluge branch libtorrentv1"
GHA_TRIGGER_URL="https://github.com/linuxserver/docker-deluge/actions/runs/${{ github.run_id }}"
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 16711680,
"description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n**Trigger URL:** '"${GHA_TRIGGER_URL}"' \n"}],
Expand All @@ -38,7 +37,7 @@ jobs:
echo "External version: \`${EXT_RELEASE}\`" >> $GITHUB_STEP_SUMMARY
echo "Retrieving last pushed version" >> $GITHUB_STEP_SUMMARY
image="linuxserver/deluge"
tag="latest"
tag="libtorrentv1"
token=$(curl -sX GET \
"https://ghcr.io/token?scope=repository%3Alinuxserver%2Fdeluge%3Apull" \
| jq -r '.token')
Expand All @@ -65,7 +64,7 @@ jobs:
if [ -z "${IMAGE_VERSION}" ]; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "Can't retrieve last pushed version, exiting" >> $GITHUB_STEP_SUMMARY
FAILURE_REASON="Can't retrieve last pushed version for deluge tag latest"
FAILURE_REASON="Can't retrieve last pushed version for deluge tag libtorrentv1"
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 16711680,
"description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}],
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
Expand All @@ -75,21 +74,14 @@ jobs:
if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
echo "Version \`${EXT_RELEASE}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY
exit 0
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"deluge"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
echo "New version \`${EXT_RELEASE}\` found; but not all arch repos updated yet; exiting" >> $GITHUB_STEP_SUMMARY
FAILURE_REASON="New version ${EXT_RELEASE} for deluge tag latest is detected, however not all arch repos are updated yet. Will try again later."
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
"description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}],
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
exit 0
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/master/lastBuild/api/json | jq -r '.building') == "true" ]; then
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/libtorrentv1/lastBuild/api/json | jq -r '.building') == "true" ]; then
echo "New version \`${EXT_RELEASE}\` found; but there already seems to be an active build on Jenkins; exiting" >> $GITHUB_STEP_SUMMARY
exit 0
else
printf "\n## Trigger new build\n\n" >> $GITHUB_STEP_SUMMARY
echo "New version \`${EXT_RELEASE}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
response=$(curl -iX POST \
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/master/buildWithParameters?PACKAGE_CHECK=false \
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/libtorrentv1/buildWithParameters?PACKAGE_CHECK=false \
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
echo "Jenkins [job queue url](${response%$'\r'})" >> $GITHUB_STEP_SUMMARY
echo "Sleeping 10 seconds until job starts" >> $GITHUB_STEP_SUMMARY
Expand All @@ -104,7 +96,7 @@ jobs:
--data-urlencode "description=GHA external trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--data-urlencode "Submit=Submit"
echo "**** Notifying Discord ****"
TRIGGER_REASON="A version change was detected for deluge tag latest. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
TRIGGER_REASON="A version change was detected for deluge tag libtorrentv1. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
"description": "**Build Triggered** \n**Reason:** '"${TRIGGER_REASON}"' \n**Build URL:** '"${buildurl}display/redirect"' \n"}],
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
- uses: actions/first-interaction@v1
with:
issue-message: 'Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.'
pr-message: 'Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/linuxserver/docker-deluge/blob/master/.github/PULL_REQUEST_TEMPLATE.md)!'
pr-message: 'Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/linuxserver/docker-deluge/blob/libtorrentv1/.github/PULL_REQUEST_TEMPLATE.md)!'
repo-token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 7 additions & 7 deletions .github/workflows/package_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ on:
workflow_dispatch:

jobs:
package-trigger-master:
package-trigger-libtorrentv1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1

- name: Package Trigger
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/libtorrentv1'
run: |
printf "# Package trigger for docker-deluge\n\n" >> $GITHUB_STEP_SUMMARY
if [ -n "${{ secrets.PAUSE_PACKAGE_TRIGGER_DELUGE_MASTER }}" ]; then
if [ -n "${{ secrets.PAUSE_PACKAGE_TRIGGER_DELUGE_LIBTORRENTV1 }}" ]; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "> Github secret \`PAUSE_PACKAGE_TRIGGER_DELUGE_MASTER\` is set; skipping trigger." >> $GITHUB_STEP_SUMMARY
echo "> Github secret \`PAUSE_PACKAGE_TRIGGER_DELUGE_LIBTORRENTV1\` is set; skipping trigger." >> $GITHUB_STEP_SUMMARY
exit 0
fi
if [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/master/lastBuild/api/json | jq -r '.building') == "true" ]; then
if [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/libtorrentv1/lastBuild/api/json | jq -r '.building') == "true" ]; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "> There already seems to be an active build on Jenkins; skipping package trigger" >> $GITHUB_STEP_SUMMARY
exit 0
fi
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
echo "> Package trigger running off of master branch. To disable, set a Github secret named \`PAUSE_PACKAGE_TRIGGER_DELUGE_MASTER\`" >> $GITHUB_STEP_SUMMARY
echo "> Package trigger running off of libtorrentv1 branch. To disable, set a Github secret named \`PAUSE_PACKAGE_TRIGGER_DELUGE_LIBTORRENTV1\`" >> $GITHUB_STEP_SUMMARY
response=$(curl -iX POST \
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/master/buildWithParameters?PACKAGE_CHECK=true \
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-deluge/job/libtorrentv1/buildWithParameters?PACKAGE_CHECK=true \
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
echo "Jenkins [job queue url](${response%$'\r'})" >> $GITHUB_STEP_SUMMARY
echo "Sleeping 10 seconds until job starts" >> $GITHUB_STEP_SUMMARY
Expand Down
31 changes: 21 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

FROM ghcr.io/linuxserver/unrar:latest AS unrar

FROM ghcr.io/linuxserver/baseimage-alpine:edge
FROM ghcr.io/by275/libtorrent:1-alpine3.20 AS libtorrent

FROM ghcr.io/linuxserver/baseimage-alpine:3.20

# set version label
ARG BUILD_DATE
Expand All @@ -19,20 +21,25 @@ ENV PYTHON_EGG_CACHE="/config/plugins/.python-eggs" \
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --upgrade --virtual=build-dependencies \
build-base && \
build-base \
python3-dev && \
echo "**** install packages ****" && \
apk add --no-cache --upgrade --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
apk add --no-cache --upgrade \
boost1.84-python3 \
geoip \
python3 \
py3-future \
py3-geoip \
py3-requests \
p7zip && \
if [ -z ${DELUGE_VERSION+x} ]; then \
DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
&& awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
DELUGE_VERSION=$(curl -sL https://pypi.python.org/pypi/deluge/json |jq -r '. | .info.version');\
fi && \
apk add -U --upgrade --no-cache \
deluge==${DELUGE_VERSION} && \
python3 -m venv /lsiopy && \
pip install -U --no-cache-dir \
pip \
setuptools \
wheel && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20/ \
deluge[all]==${DELUGE_VERSION} \
pygeoip && \
echo "**** grab GeoIP database ****" && \
curl -L --retry 10 --retry-max-time 60 --retry-all-errors \
"https://mailfud.org/geoip-legacy/GeoIP.dat.gz" \
Expand All @@ -45,6 +52,10 @@ RUN \
$HOME/.cache \
/tmp/*

COPY --from=libtorrent /libtorrent-build/usr/lib/libtorrent-rasterbar.* /usr/lib/

COPY --from=libtorrent /libtorrent-build/usr/lib/python3.12 /lsiopy/lib/python3.12

# add local files
COPY root/ /

Expand Down
31 changes: 21 additions & 10 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

FROM ghcr.io/linuxserver/unrar:arm64v8-latest AS unrar

FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-edge
FROM ghcr.io/by275/libtorrent:1-alpine3.20-arm64 AS libtorrent

FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.20

# set version label
ARG BUILD_DATE
Expand All @@ -19,20 +21,25 @@ ENV PYTHON_EGG_CACHE="/config/plugins/.python-eggs" \
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --upgrade --virtual=build-dependencies \
build-base && \
build-base \
python3-dev && \
echo "**** install packages ****" && \
apk add --no-cache --upgrade --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
apk add --no-cache --upgrade \
boost1.84-python3 \
geoip \
python3 \
py3-future \
py3-geoip \
py3-requests \
p7zip && \
if [ -z ${DELUGE_VERSION+x} ]; then \
DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
&& awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
DELUGE_VERSION=$(curl -sL https://pypi.python.org/pypi/deluge/json |jq -r '. | .info.version');\
fi && \
apk add -U --upgrade --no-cache \
deluge==${DELUGE_VERSION} && \
python3 -m venv /lsiopy && \
pip install -U --no-cache-dir \
pip \
setuptools \
wheel && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20/ \
deluge[all]==${DELUGE_VERSION} \
pygeoip && \
echo "**** grab GeoIP database ****" && \
curl -L --retry 10 --retry-max-time 60 --retry-all-errors \
"https://mailfud.org/geoip-legacy/GeoIP.dat.gz" \
Expand All @@ -45,6 +52,10 @@ RUN \
$HOME/.cache \
/tmp/*

COPY --from=libtorrent /libtorrent-build/usr/lib/libtorrent-rasterbar.* /usr/lib/

COPY --from=libtorrent /libtorrent-build/usr/lib/python3.12 /lsiopy/lib/python3.12

# add local files
COPY root/ /

Expand Down
Loading