mirror of
https://github.com/linuxserver/docker-ombi.git
synced 2026-02-20 00:58:02 +08:00
commit
51cc6ee9c3
47
.github/workflows/external_trigger.yml
vendored
47
.github/workflows/external_trigger.yml
vendored
@ -17,30 +17,8 @@ jobs:
|
||||
exit 0
|
||||
fi
|
||||
echo "External trigger running off of v4-preview branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_OMBI_V4_PREVIEW\"."
|
||||
echo "Setting env vars"
|
||||
EXT_GIT_BRANCH='master'
|
||||
EXT_USER='tidusjar'
|
||||
EXT_REPO='Ombi.Releases'
|
||||
CONTAINER_NAME='ombi'
|
||||
BUILD_VERSION_ARG='OMBI_RELEASE'
|
||||
LS_USER='linuxserver'
|
||||
LS_REPO='docker-ombi'
|
||||
DOCKERHUB_IMAGE='linuxserver/ombi'
|
||||
DEV_DOCKERHUB_IMAGE='lsiodev/ombi'
|
||||
PR_DOCKERHUB_IMAGE='lspipepr/ombi'
|
||||
DIST_IMAGE='ubuntu'
|
||||
DIST_TAG='bionic'
|
||||
MULTIARCH='true'
|
||||
CI='true'
|
||||
CI_WEB='true'
|
||||
CI_PORT='3579'
|
||||
CI_SSL='false'
|
||||
CI_DELAY='120'
|
||||
CI_DOCKERENV='TZ=US/Pacific'
|
||||
CI_AUTH='user:password'
|
||||
CI_WEBPATH=''
|
||||
echo "Retrieving external version"
|
||||
EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases" | jq -r '.[0] | .tag_name')
|
||||
EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/tidusjar/Ombi.Releases/releases" | jq -r '.[0] | .tag_name')
|
||||
if [ -z "${EXT_RELEASE}" ]; then
|
||||
echo "Can't retrieve external version, exiting"
|
||||
FAILURE_REASON="Can't retrieve external version for ombi branch v4-preview"
|
||||
@ -51,19 +29,24 @@ jobs:
|
||||
fi
|
||||
echo "External version: ${EXT_RELEASE}"
|
||||
echo "Retrieving last pushed version"
|
||||
image="${LS_USER}/ombi"
|
||||
image="linuxserver/ombi"
|
||||
tag="v4-preview"
|
||||
token=$(curl -s \
|
||||
"https://auth.docker.io/token?scope=repository:${image}:pull&service=registry.docker.io" \
|
||||
token=$(curl -sX GET \
|
||||
"https://ghcr.io/token?scope=repository%3Alinuxserver%2Fombi%3Apull" \
|
||||
| jq -r '.token')
|
||||
digest=$(curl -s \
|
||||
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||
--header "Authorization: Bearer ${token}" \
|
||||
"https://registry-1.docker.io/v2/${image}/manifests/${tag}" \
|
||||
| jq -r '.config.digest')
|
||||
multidigest=$(curl -s \
|
||||
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||
--header "Authorization: Bearer ${token}" \
|
||||
"https://ghcr.io/v2/${image}/manifests/${tag}" \
|
||||
| jq -r 'first(.manifests[].digest)')
|
||||
digest=$(curl -s \
|
||||
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||
--header "Authorization: Bearer ${token}" \
|
||||
"https://ghcr.io/v2/${image}/manifests/${multidigest}" \
|
||||
| jq -r '.config.digest')
|
||||
image_info=$(curl -sL \
|
||||
--header "Authorization: Bearer ${token}" \
|
||||
"https://registry-1.docker.io/v2/${image}/blobs/${digest}" \
|
||||
"https://ghcr.io/v2/${image}/blobs/${digest}" \
|
||||
| jq -r '.container_config')
|
||||
IMAGE_RELEASE=$(echo ${image_info} | jq -r '.Labels.build_version' | awk '{print $3}')
|
||||
IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-ls' '{print $1}')
|
||||
|
||||
41
.github/workflows/external_trigger_scheduler.yml
vendored
Normal file
41
.github/workflows/external_trigger_scheduler.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: External Trigger Scheduler
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '32 * * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
external-trigger-scheduler:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
|
||||
- name: External Trigger Scheduler
|
||||
run: |
|
||||
git for-each-ref --format='%(refname:short)' refs/remotes
|
||||
docker pull ghcr.io/linuxserver/yq
|
||||
for br in $(git for-each-ref --format='%(refname:short)' refs/remotes)
|
||||
do
|
||||
br=$(echo "$br" | sed 's|origin/||g')
|
||||
echo "Evaluating branch ${br}"
|
||||
ls_branch=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-ombi/${br}/jenkins-vars.yml \
|
||||
| docker run --rm -i --entrypoint yq ghcr.io/linuxserver/yq -r .ls_branch)
|
||||
if [ "$br" == "$ls_branch" ]; then
|
||||
echo "${br} is a live branch, checking workflow."
|
||||
if curl -sfX GET https://raw.githubusercontent.com/linuxserver/docker-ombi/${br}/.github/workflows/external_trigger.yml > /dev/null 2>&1; then
|
||||
echo "Workflow exists. Triggering external trigger workflow for branch ${br}."
|
||||
curl -iX POST \
|
||||
-H "Authorization: token ${{ secrets.CR_PAT }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-d "{\"ref\":\"refs/heads/${br}\"}" \
|
||||
https://api.github.com/repos/linuxserver/docker-ombi/actions/workflows/external_trigger.yml/dispatches
|
||||
else
|
||||
echo "Workflow doesn't exist; skipping trigger."
|
||||
fi
|
||||
else
|
||||
echo "${br} appears to be a dev branch; skipping trigger."
|
||||
fi
|
||||
done
|
||||
42
.github/workflows/package_trigger_scheduler.yml
vendored
Normal file
42
.github/workflows/package_trigger_scheduler.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
name: Package Trigger Scheduler
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '54 14 * * 4'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
package-trigger-scheduler:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
|
||||
- name: Package Trigger Scheduler
|
||||
run: |
|
||||
git for-each-ref --format='%(refname:short)' refs/remotes
|
||||
docker pull ghcr.io/linuxserver/yq
|
||||
for br in $(git for-each-ref --format='%(refname:short)' refs/remotes)
|
||||
do
|
||||
br=$(echo "$br" | sed 's|origin/||g')
|
||||
echo "Evaluating branch ${br}"
|
||||
ls_branch=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-ombi/${br}/jenkins-vars.yml \
|
||||
| docker run --rm -i --entrypoint yq ghcr.io/linuxserver/yq -r .ls_branch)
|
||||
if [ "${br}" == "${ls_branch}" ]; then
|
||||
echo "Branch ${br} appears to be live; triggering."
|
||||
if curl -sfX GET https://raw.githubusercontent.com/linuxserver/docker-ombi/${br}/.github/workflows/package_trigger.yml > /dev/null 2>&1; then
|
||||
echo "Workflow exists. Triggering package trigger workflow for branch ${br}."
|
||||
curl -iX POST \
|
||||
-H "Authorization: token ${{ secrets.CR_PAT }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-d "{\"ref\":\"refs/heads/${br}\"}" \
|
||||
https://api.github.com/repos/linuxserver/docker-ombi/actions/workflows/package_trigger.yml/dispatches
|
||||
sleep 30
|
||||
else
|
||||
echo "Workflow doesn't exist; skipping trigger."
|
||||
fi
|
||||
else
|
||||
echo "${br} appears to be a dev branch; skipping trigger."
|
||||
fi
|
||||
done
|
||||
Loading…
x
Reference in New Issue
Block a user