Verify human and Renovate PR routing without publishing
This commit is contained in:
parent
723a29c04a
commit
28f71a21d1
3 changed files with 67 additions and 53 deletions
67
.forgejo/workflows/c3-pr-policy.yml
Normal file
67
.forgejo/workflows/c3-pr-policy.yml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
name: C3 PR policy verification
|
||||
'on':
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
route:
|
||||
runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login
|
||||
== 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref,
|
||||
'renovate/')) && 'renovate' || 'docker' }}
|
||||
if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor)
|
||||
&& (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'),
|
||||
github.event.pull_request.user.login)) }}
|
||||
env:
|
||||
CI_UNTRUSTED: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login
|
||||
== 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref,
|
||||
'renovate/')) }}
|
||||
REGISTRY_TOKEN: ${{ !(github.actor == 'renovate-bot' || github.event.pull_request.user.login
|
||||
== 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref,
|
||||
'renovate/')) && secrets.FORGEJO_PACKAGE_TOKEN || '' }}
|
||||
steps:
|
||||
- name: Verify identity routing and credential boundary
|
||||
run: "set -eu\ntest ! -S /var/run/docker.sock\ntest ! -e /pages\nawk '$1 ==\
|
||||
\ 0 { if ($2 == 0) exit 1; found=1 } END { if (!found) exit 1 }' /proc/self/uid_map\n\
|
||||
if [ \"$CI_UNTRUSTED\" = true ]; then\n test -z \"$REGISTRY_TOKEN\"\n echo\
|
||||
\ BOT_SECRET_FREE_ROOTLESS_OK\nelse\n test -n \"$REGISTRY_TOKEN\"\n echo\
|
||||
\ HUMAN_FULL_CONTAINER_OK\nfi\nmkdir context\nprintf 'FROM docker.io/library/alpine:3.22\\\
|
||||
nRUN echo verified >/proof\\n' >context/Dockerfile\n"
|
||||
- name: Build without publishing or registry credentials
|
||||
uses: https://git.schmelczer.dev/andras/ci-actions/docker-publish@c80f2f0701d7618f1f0b2bb52ebd332ea34b6e28
|
||||
with:
|
||||
context: context
|
||||
push: 'false'
|
||||
full-environment:
|
||||
runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login
|
||||
== 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref,
|
||||
'renovate/')) && 'renovate-ubuntu' || 'ubuntu-latest' }}
|
||||
if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor)
|
||||
&& (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'),
|
||||
github.event.pull_request.user.login)) }}
|
||||
steps:
|
||||
- run: 'set -eu
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
test "$ID" = ubuntu
|
||||
|
||||
sudo -n true
|
||||
|
||||
node --version
|
||||
|
||||
git --version
|
||||
|
||||
test ! -S /var/run/docker.sock
|
||||
|
||||
echo FULL_CI_IMAGE_OK
|
||||
|
||||
'
|
||||
trusted-release-gate:
|
||||
runs-on: docker
|
||||
if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor)
|
||||
&& (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'),
|
||||
github.event.pull_request.user.login)) && !(github.actor == 'renovate-bot' ||
|
||||
github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref,
|
||||
'refs/heads/renovate/') || startsWith(github.head_ref, 'renovate/')) }}
|
||||
steps:
|
||||
- run: echo TRUSTED_HUMAN_GATE_OK
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
name: Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
tags: ['v*.*.*']
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref,
|
||||
'renovate/')) && 'renovate' || 'docker' }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Build and publish image
|
||||
uses: https://git.schmelczer.dev/andras/ci-actions/docker-publish@c80f2f0701d7618f1f0b2bb52ebd332ea34b6e28
|
||||
with:
|
||||
context: .
|
||||
push: ${{ !(github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') ||
|
||||
startsWith(github.head_ref, 'renovate/')) && (github.event_name != 'pull_request') }}
|
||||
token: ${{ !(github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/')
|
||||
|| startsWith(github.head_ref, 'renovate/')) && (secrets.FORGEJO_PACKAGE_TOKEN) || '' }}
|
||||
if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'),
|
||||
github.event.pull_request.user.login)) }}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
name: ShellCheck
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
shellcheck:
|
||||
runs-on: ${{ (github.actor == 'renovate-bot' || github.event.pull_request.user.login == 'renovate-bot' || startsWith(github.ref, 'refs/heads/renovate/') || startsWith(github.head_ref,
|
||||
'renovate/')) && 'renovate' || 'docker' }}
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install ShellCheck
|
||||
run: apt-get update && apt-get install -y shellcheck
|
||||
|
||||
- name: Run ShellCheck
|
||||
run: find ./src -name '*.sh' -exec shellcheck {} +
|
||||
if: ${{ contains(fromJSON('["andras","ruby336688","renovate-bot"]'), github.actor) && (!github.event.pull_request || contains(fromJSON('["andras","ruby336688","renovate-bot"]'),
|
||||
github.event.pull_request.user.login)) }}
|
||||
Loading…
Reference in a new issue