mirror of
https://github.com/snipe/snipe-it.git
synced 2026-08-18 03:06:23 +00:00
Merge pull request #19397 from markof88/scheduled-docker-rebuild
Rebuild Docker images weekly to pick up security patches
This commit is contained in:
20
.github/workflows/docker-alpine.yml
vendored
20
.github/workflows/docker-alpine.yml
vendored
@ -10,6 +10,11 @@ on:
|
|||||||
- develop
|
- develop
|
||||||
tags:
|
tags:
|
||||||
- 'v**'
|
- 'v**'
|
||||||
|
# Weekly rebuild so the rolling 'v{major}-latest-alpine' tag picks up
|
||||||
|
# base-OS security patches (e.g. Alpine apk package updates) even when no
|
||||||
|
# new Snipe-IT version has been tagged. Does NOT touch immutable vX.Y.Z tags.
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * 1'
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -46,6 +51,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
# On a scheduled run there's no tag/branch push event to derive the ref
|
||||||
|
# from, so explicitly check out the most recent published release tag
|
||||||
|
# before building - this is what gets rebuilt to refresh v{major}-latest-alpine.
|
||||||
|
- name: Checkout latest release tag (scheduled runs only)
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
latest_tag=$(git tag -l 'v*' --sort=-v:refname | head -n1)
|
||||||
|
echo "Rebuilding latest release tag: $latest_tag"
|
||||||
|
git checkout "$latest_tag"
|
||||||
|
|
||||||
# https://github.com/docker/setup-buildx-action
|
# https://github.com/docker/setup-buildx-action
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
@ -69,7 +85,9 @@ jobs:
|
|||||||
uses: docker/metadata-action@v6
|
uses: docker/metadata-action@v6
|
||||||
with:
|
with:
|
||||||
images: snipe/snipe-it
|
images: snipe/snipe-it
|
||||||
tags: ${{ env.IMAGE_TAGS }}
|
# On schedule, metadata-action can't derive tags from github.ref
|
||||||
|
# (it still points at the default branch) - only emit v{major}-latest-alpine.
|
||||||
|
tags: ${{ github.event_name == 'schedule' && 'type=semver,pattern=v{{major}}-latest-alpine' || env.IMAGE_TAGS }}
|
||||||
flavor: ${{ env.TAGS_FLAVOR }}
|
flavor: ${{ env.TAGS_FLAVOR }}
|
||||||
|
|
||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
|
|||||||
20
.github/workflows/docker-ubuntu.yml
vendored
20
.github/workflows/docker-ubuntu.yml
vendored
@ -10,6 +10,11 @@ on:
|
|||||||
- develop
|
- develop
|
||||||
tags:
|
tags:
|
||||||
- 'v**'
|
- 'v**'
|
||||||
|
# Weekly rebuild so the rolling 'v{major}-latest' tag picks up base-OS
|
||||||
|
# security patches (e.g. Ubuntu apt package updates) even when no new
|
||||||
|
# Snipe-IT version has been tagged. Does NOT touch immutable vX.Y.Z tags.
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * 1'
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -46,6 +51,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
# On a scheduled run there's no tag/branch push event to derive the ref
|
||||||
|
# from, so explicitly check out the most recent published release tag
|
||||||
|
# before building - this is what gets rebuilt to refresh v{major}-latest.
|
||||||
|
- name: Checkout latest release tag (scheduled runs only)
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
latest_tag=$(git tag -l 'v*' --sort=-v:refname | head -n1)
|
||||||
|
echo "Rebuilding latest release tag: $latest_tag"
|
||||||
|
git checkout "$latest_tag"
|
||||||
|
|
||||||
# https://github.com/docker/setup-buildx-action
|
# https://github.com/docker/setup-buildx-action
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
@ -69,7 +85,9 @@ jobs:
|
|||||||
uses: docker/metadata-action@v6
|
uses: docker/metadata-action@v6
|
||||||
with:
|
with:
|
||||||
images: snipe/snipe-it
|
images: snipe/snipe-it
|
||||||
tags: ${{ env.IMAGE_TAGS }}
|
# On schedule, metadata-action can't derive tags from github.ref
|
||||||
|
# (it still points at the default branch) - only emit v{major}-latest.
|
||||||
|
tags: ${{ github.event_name == 'schedule' && 'type=semver,pattern=v{{major}}-latest' || env.IMAGE_TAGS }}
|
||||||
flavor: ${{ env.TAGS_FLAVOR }}
|
flavor: ${{ env.TAGS_FLAVOR }}
|
||||||
|
|
||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
|
|||||||
Reference in New Issue
Block a user