mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-27 15:57:07 +03:00
pin third-party actions and scope workflow tokens (#25094)
easimon/maximize-build-space ran from a branch, and the lowercase and manifest actions ran from mutable tags, inside jobs that push images and mint build attestations. The release workflow also ran skopeo from its latest tag with the push credential mounted. The actions are now pinned to commit SHAs with version comments so Dependabot still bumps them, the lowercase action is replaced with ${GITHUB_REPOSITORY,,}, and skopeo is pinned by digest. ci.yml, release.yml, pull_request.yml and stale.yml now declare explicit token permissions instead of relying on the repository default.
This commit is contained in:
@@ -23,7 +23,7 @@ runs:
|
|||||||
# from root and temp-reserve-mb is what actually stays free on root. Keep 4G
|
# from root and temp-reserve-mb is what actually stays free on root. Keep 4G
|
||||||
# there for setup-qemu/buildx caches in ~/.docker and the tool cache
|
# there for setup-qemu/buildx caches in ~/.docker and the tool cache
|
||||||
- name: Maximize build space
|
- name: Maximize build space
|
||||||
uses: easimon/maximize-build-space@master
|
uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c # v10
|
||||||
with:
|
with:
|
||||||
root-reserve-mb: 8192
|
root-reserve-mb: 8192
|
||||||
temp-reserve-mb: 4096
|
temp-reserve-mb: 4096
|
||||||
@@ -36,9 +36,8 @@ runs:
|
|||||||
run: sudo systemctl start docker
|
run: sudo systemctl start docker
|
||||||
shell: bash
|
shell: bash
|
||||||
- id: lowercaseRepo
|
- id: lowercaseRepo
|
||||||
uses: ASzc/change-string-case-action@v8
|
run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
|
||||||
with:
|
shell: bash
|
||||||
string: ${{ github.repository }}
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ concurrency:
|
|||||||
group: ${{ github.ref }}
|
group: ${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: 3.11
|
PYTHON_VERSION: 3.11
|
||||||
|
|
||||||
@@ -21,6 +24,9 @@ jobs:
|
|||||||
amd64_build:
|
amd64_build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
name: AMD64 Build
|
name: AMD64 Build
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
@@ -45,6 +51,9 @@ jobs:
|
|||||||
smoke_test:
|
smoke_test:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
name: AMD64 Smoke Test
|
name: AMD64 Smoke Test
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: read
|
||||||
needs:
|
needs:
|
||||||
- amd64_build
|
- amd64_build
|
||||||
steps:
|
steps:
|
||||||
@@ -675,9 +684,7 @@ jobs:
|
|||||||
- arm64_build
|
- arm64_build
|
||||||
steps:
|
steps:
|
||||||
- id: lowercaseRepo
|
- id: lowercaseRepo
|
||||||
uses: ASzc/change-string-case-action@v8
|
run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
|
||||||
with:
|
|
||||||
string: ${{ github.repository }}
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
|
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
|
||||||
with:
|
with:
|
||||||
@@ -686,7 +693,7 @@ jobs:
|
|||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Create short sha
|
- name: Create short sha
|
||||||
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||||
- uses: int128/docker-manifest-create-action@v2
|
- uses: int128/docker-manifest-create-action@d6ac360314337bbfb870747d9616b83118acb330 # v2.30.0
|
||||||
id: manifest
|
id: manifest
|
||||||
with:
|
with:
|
||||||
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}
|
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ on:
|
|||||||
- ".github/DISCUSSION_TEMPLATE/**"
|
- ".github/DISCUSSION_TEMPLATE/**"
|
||||||
- ".github/ISSUE_TEMPLATE/**"
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DEFAULT_PYTHON: 3.11
|
DEFAULT_PYTHON: 3.11
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ on:
|
|||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -14,9 +18,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- id: lowercaseRepo
|
- id: lowercaseRepo
|
||||||
uses: ASzc/change-string-case-action@v8
|
run: echo "lowercase=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
|
||||||
with:
|
|
||||||
string: ${{ github.repository }}
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
|
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550
|
||||||
with:
|
with:
|
||||||
@@ -34,19 +36,21 @@ jobs:
|
|||||||
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||||
echo "CLEAN_VERSION=$(echo ${GITHUB_REF##*/} | tr '[:upper:]' '[:lower:]' | sed 's/^[v]//')" >> $GITHUB_ENV
|
echo "CLEAN_VERSION=$(echo ${GITHUB_REF##*/} | tr '[:upper:]' '[:lower:]' | sed 's/^[v]//')" >> $GITHUB_ENV
|
||||||
- name: Tag and push the main image
|
- name: Tag and push the main image
|
||||||
|
env:
|
||||||
|
SKOPEO: quay.io/skopeo/stable:v1.24.1-immutable@sha256:81a8d4265c339539cba229459fdc4cb3580e1d2c2cb4285271c75adaa0fcb9b5
|
||||||
run: |
|
run: |
|
||||||
VERSION_TAG=${BASE}:${CLEAN_VERSION}
|
VERSION_TAG=${BASE}:${CLEAN_VERSION}
|
||||||
STABLE_TAG=${BASE}:stable
|
STABLE_TAG=${BASE}:stable
|
||||||
PULL_TAG=${BASE}:${BUILD_TAG}
|
PULL_TAG=${BASE}:${BUILD_TAG}
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${VERSION_TAG}
|
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${VERSION_TAG}
|
||||||
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
|
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${VERSION_TAG}-${variant}
|
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${VERSION_TAG}-${variant}
|
||||||
done
|
done
|
||||||
|
|
||||||
# stable tag
|
# stable tag
|
||||||
if [[ "${BUILD_TYPE}" == "stable" ]]; then
|
if [[ "${BUILD_TYPE}" == "stable" ]]; then
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${STABLE_TAG}
|
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${STABLE_TAG}
|
||||||
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
|
for variant in standard-arm64 tensorrt tensorrt-jp6 rk rocm synaptics; do
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${STABLE_TAG}-${variant}
|
docker run --rm -v $HOME/.docker/config.json:/config.json ${SKOPEO} copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${STABLE_TAG}-${variant}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,11 +7,16 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *" # run stalebot once a day
|
- cron: "0 0 * * *" # run stalebot once a day
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@main
|
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
|
||||||
id: stale
|
id: stale
|
||||||
with:
|
with:
|
||||||
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
|
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
|
||||||
|
|||||||
Reference in New Issue
Block a user