Skip to content

Commit 8e277e7

Browse files
authored
Merge pull request #8 from linuxserver/selkies
Rebase to Selkies swap to appimage ingestion
2 parents b485a58 + 6e4118b commit 8e277e7

14 files changed

Lines changed: 179 additions & 184 deletions

.github/workflows/call_issue_pr_tracker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request_review:
99
types: [submitted,edited,dismissed]
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
manage-project:
1316
permissions:

.github/workflows/call_issues_cron.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
- cron: '50 2 * * *'
55
workflow_dispatch:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
stale:
912
permissions:

.github/workflows/external_trigger.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: External Trigger Main
33
on:
44
workflow_dispatch:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
external-trigger-master:
811
runs-on: ubuntu-latest
@@ -26,8 +29,8 @@ jobs:
2629
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
2730
echo "> External trigger running off of master branch. To disable this trigger, add \`freecad_master\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY
2831
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
29-
EXT_RELEASE=$(curl -sX GET https://ftp.debian.org/debian/dists/bookworm/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: freecad' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '+' '{print $1}')
30-
echo "Type is \`custom_version_command\`" >> $GITHUB_STEP_SUMMARY
32+
EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/FreeCAD/FreeCAD/releases/latest" | jq -r '. | .tag_name')
33+
echo "Type is \`github_stable\`" >> $GITHUB_STEP_SUMMARY
3134
if grep -q "^freecad_master_${EXT_RELEASE}" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
3235
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
3336
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` matches current external release; skipping trigger." >> $GITHUB_STEP_SUMMARY
@@ -43,8 +46,8 @@ jobs:
4346
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
4447
exit 1
4548
fi
46-
EXT_RELEASE=$(echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g')
47-
echo "External version: \`${EXT_RELEASE}\`" >> $GITHUB_STEP_SUMMARY
49+
EXT_RELEASE_SANITIZED=$(echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g')
50+
echo "Sanitized external version: \`${EXT_RELEASE_SANITIZED}\`" >> $GITHUB_STEP_SUMMARY
4851
echo "Retrieving last pushed version" >> $GITHUB_STEP_SUMMARY
4952
image="linuxserver/freecad"
5053
tag="latest"
@@ -100,8 +103,8 @@ jobs:
100103
exit 1
101104
fi
102105
echo "Last pushed version: \`${IMAGE_VERSION}\`" >> $GITHUB_STEP_SUMMARY
103-
if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
104-
echo "Version \`${EXT_RELEASE}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY
106+
if [ "${EXT_RELEASE_SANITIZED}" == "${IMAGE_VERSION}" ]; then
107+
echo "Sanitized version \`${EXT_RELEASE_SANITIZED}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY
105108
exit 0
106109
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-freecad/job/master/lastBuild/api/json | jq -r '.building') == "true" ]; then
107110
echo "New version \`${EXT_RELEASE}\` found; but there already seems to be an active build on Jenkins; exiting" >> $GITHUB_STEP_SUMMARY
@@ -116,7 +119,7 @@ jobs:
116119
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
117120
else
118121
printf "\n## Trigger new build\n\n" >> $GITHUB_STEP_SUMMARY
119-
echo "New version \`${EXT_RELEASE}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
122+
echo "New sanitized version \`${EXT_RELEASE_SANITIZED}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
120123
if [[ "${artifacts_found}" == "true" ]]; then
121124
echo "All artifacts seem to be uploaded." >> $GITHUB_STEP_SUMMARY
122125
fi
@@ -136,7 +139,7 @@ jobs:
136139
--data-urlencode "description=GHA external trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
137140
--data-urlencode "Submit=Submit"
138141
echo "**** Notifying Discord ****"
139-
TRIGGER_REASON="A version change was detected for freecad tag latest. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
142+
TRIGGER_REASON="A version change was detected for freecad tag latest. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE_SANITIZED}"
140143
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
141144
"description": "**Build Triggered** \n**Reason:** '"${TRIGGER_REASON}"' \n**Build URL:** '"${buildurl}display/redirect"' \n"}],
142145
"username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}

.github/workflows/external_trigger_scheduler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- cron: '40 * * * *'
66
workflow_dispatch:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
external-trigger-scheduler:
1013
runs-on: ubuntu-latest

.github/workflows/greetings.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ name: Greetings
22

33
on: [pull_request_target, issues]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
greeting:
10+
permissions:
11+
issues: write
12+
pull-requests: write
713
runs-on: ubuntu-latest
814
steps:
915
- uses: actions/first-interaction@v1

.github/workflows/package_trigger_scheduler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- cron: '18 10 * * 6'
66
workflow_dispatch:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
package-trigger-scheduler:
1013
runs-on: ubuntu-latest

Dockerfile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbookworm
1+
FROM ghcr.io/linuxserver/baseimage-selkies:debianbookworm
22

33
# set version label
44
ARG BUILD_DATE
@@ -13,14 +13,28 @@ ENV TITLE=FreeCAD
1313
RUN \
1414
echo "**** add icon ****" && \
1515
curl -o \
16-
/kclient/public/icon.png \
16+
/usr/share/selkies/www/icon.png \
1717
https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/freecad-logo.png && \
1818
echo "**** install packages ****" && \
19-
apt-get update && \
20-
apt-get install -y --no-install-recommends \
21-
freecad \
22-
python3-pyside2.qtwebchannel \
23-
python3-pyside2.qtwebengine* && \
19+
DOWNLOAD_URL=$(curl -sX GET "https://api.github.com/repos/FreeCAD/FreeCAD/releases/latest" \
20+
| awk -F '(": "|")' '/browser.*Linux-x86_64-py311.AppImage/ {print $3;exit}') && \
21+
curl -o \
22+
/tmp/freecad.app -L \
23+
"${DOWNLOAD_URL}" && \
24+
cd /tmp && \
25+
chmod +x freecad.app && \
26+
./freecad.app --appimage-extract && \
27+
mv \
28+
squashfs-root \
29+
/opt/freecad && \
30+
echo "**** launcher ****" && \
31+
echo \
32+
"#!/bin/bash" \
33+
> /usr/bin/freecad && \
34+
echo \
35+
"xterm -e /opt/freecad/AppRun \"\${@}\"" \
36+
>> /usr/bin/freecad && \
37+
chmod +x /usr/bin/freecad && \
2438
echo "**** cleanup ****" && \
2539
apt-get autoclean && \
2640
rm -rf \

Dockerfile.aarch64

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/linuxserver/baseimage-kasmvnc:arm64v8-debianbookworm
1+
FROM ghcr.io/linuxserver/baseimage-selkies:arm64v8-debianbookworm
22

33
# set version label
44
ARG BUILD_DATE
@@ -13,15 +13,28 @@ ENV TITLE=FreeCAD
1313
RUN \
1414
echo "**** add icon ****" && \
1515
curl -o \
16-
/kclient/public/icon.png \
16+
/usr/share/selkies/www/icon.png \
1717
https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/freecad-logo.png && \
1818
echo "**** install packages ****" && \
19-
apt-get update && \
20-
apt-get install -y --no-install-recommends \
21-
freecad \
22-
python3-pyside2.qtwebchannel \
23-
python3-pyside2.qtwebengine* && \
24-
sed -i 's|</applications>| <application title="FreeCAD*" type="normal">\n <maximized>yes</maximized>\n </application>\n</applications>|' /etc/xdg/openbox/rc.xml && \
19+
DOWNLOAD_URL=$(curl -sX GET "https://api.github.com/repos/FreeCAD/FreeCAD/releases/latest" \
20+
| awk -F '(": "|")' '/browser.*Linux-aarch64-py311.AppImage/ {print $3;exit}') && \
21+
curl -o \
22+
/tmp/freecad.app -L \
23+
"${DOWNLOAD_URL}" && \
24+
cd /tmp && \
25+
chmod +x freecad.app && \
26+
./freecad.app --appimage-extract && \
27+
mv \
28+
squashfs-root \
29+
/opt/freecad && \
30+
echo "**** launcher ****" && \
31+
echo \
32+
"#!/bin/bash" \
33+
> /usr/bin/freecad && \
34+
echo \
35+
"xterm -e /opt/freecad/AppRun \"\${@}\"" \
36+
>> /usr/bin/freecad && \
37+
chmod +x /usr/bin/freecad && \
2538
echo "**** cleanup ****" && \
2639
apt-get autoclean && \
2740
rm -rf \

Jenkinsfile

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pipeline {
1919
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
2020
QUAYIO_API_TOKEN=credentials('quayio-repo-api-token')
2121
GIT_SIGNING_KEY=credentials('484fbca6-9a4f-455e-b9e3-97ac98785f5f')
22+
EXT_GIT_BRANCH = 'master'
23+
EXT_USER = 'FreeCAD'
24+
EXT_REPO = 'FreeCAD'
2225
BUILD_VERSION_ARG = 'FREECAD_VERSION'
2326
LS_USER = 'linuxserver'
2427
LS_REPO = 'docker-freecad'
@@ -30,8 +33,8 @@ pipeline {
3033
MULTIARCH = 'true'
3134
CI = 'true'
3235
CI_WEB = 'true'
33-
CI_PORT = '3000'
34-
CI_SSL = 'false'
36+
CI_PORT = '3001'
37+
CI_SSL = 'true'
3538
CI_DELAY = '120'
3639
CI_DOCKERENV = 'TZ=US/Pacific'
3740
CI_AUTH = 'user:password'
@@ -94,7 +97,11 @@ pipeline {
9497
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
9598
env.PULL_REQUEST = env.CHANGE_ID
9699
env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml ./.github/workflows/external_trigger.yml'
100+
if ( env.SYFT_IMAGE_TAG == null ) {
101+
env.SYFT_IMAGE_TAG = 'latest'
102+
}
97103
}
104+
echo "Using syft image tag ${SYFT_IMAGE_TAG}"
98105
sh '''#! /bin/bash
99106
echo "The default github branch detected as ${GH_DEFAULT_BRANCH}" '''
100107
script{
@@ -138,16 +145,23 @@ pipeline {
138145
/* ########################
139146
External Release Tagging
140147
######################## */
141-
// If this is a custom command to determine version use that command
142-
stage("Set tag custom bash"){
143-
steps{
144-
script{
145-
env.EXT_RELEASE = sh(
146-
script: ''' curl -sX GET https://ftp.debian.org/debian/dists/bookworm/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: freecad' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '+' '{print $1}' ''',
147-
returnStdout: true).trim()
148-
env.RELEASE_LINK = 'custom_command'
149-
}
150-
}
148+
// If this is a stable github release use the latest endpoint from github to determine the ext tag
149+
stage("Set ENV github_stable"){
150+
steps{
151+
script{
152+
env.EXT_RELEASE = sh(
153+
script: '''curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''',
154+
returnStdout: true).trim()
155+
}
156+
}
157+
}
158+
// If this is a stable or devel github release generate the link for the build message
159+
stage("Set ENV github_link"){
160+
steps{
161+
script{
162+
env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE
163+
}
164+
}
151165
}
152166
// Sanitize the release tag and strip illegal docker or github characters
153167
stage("Sanitize tag"){
@@ -780,7 +794,7 @@ pipeline {
780794
docker run --rm \
781795
-v /var/run/docker.sock:/var/run/docker.sock:ro \
782796
-v ${TEMPDIR}:/tmp \
783-
ghcr.io/anchore/syft:v1.26.1 \
797+
ghcr.io/anchore/syft:${SYFT_IMAGE_TAG} \
784798
${LOCAL_CONTAINER} -o table=/tmp/package_versions.txt
785799
NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
786800
echo "Package tag sha from current packages in buit container is ${NEW_PACKAGE_TAG} comparing to old ${PACKAGE_TAG} from github"
@@ -890,6 +904,7 @@ pipeline {
890904
-e WEB_AUTH=\"${CI_AUTH}\" \
891905
-e WEB_PATH=\"${CI_WEBPATH}\" \
892906
-e NODE_NAME=\"${NODE_NAME}\" \
907+
-e SYFT_IMAGE_TAG=\"${CI_SYFT_IMAGE_TAG:-${SYFT_IMAGE_TAG}}\" \
893908
-t ghcr.io/linuxserver/ci:latest \
894909
python3 test_build.py'''
895910
}
@@ -983,7 +998,7 @@ pipeline {
983998
"tagger": {"name": "LinuxServer-CI","email": "ci@linuxserver.io","date": "'${GITHUB_DATE}'"}}' '''
984999
echo "Pushing New release for Tag"
9851000
sh '''#! /bin/bash
986-
echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json
1001+
curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json
9871002
echo '{"tag_name":"'${META_TAG}'",\
9881003
"target_commitish": "master",\
9891004
"name": "'${META_TAG}'",\

0 commit comments

Comments
 (0)