Files
DataStack/.gitea/workflows/datastack-docker-ci.yml
T

88 lines
4.7 KiB
YAML

name: DataStack Docker Build CI
on:
workflow_dispatch:
inputs:
security_probe_only:
description: Inspect locked security dependencies on disposable runner only
type: boolean
required: false
default: false
jobs:
docker-build:
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.security_probe_only != 'true' }}
runs-on: ubuntu-latest
container: node:22-alpine
timeout-minutes: 45
steps:
- name: CI-07 provision Docker Buildx CLI
run: |
set -eu
apk add --no-cache git docker-cli docker-cli-buildx docker-cli-compose
docker --version
docker buildx version
docker compose version
- uses: actions/checkout@v4
with:
github-server-url: https://dev.ivib.cc
- name: CI-07 inspect daemon and validate Compose without starting services
run: |
set -eu
docker info --format 'Driver={{.Driver}} Root={{.DockerRootDir}}'
df -h .
docker compose -f docker/docker-compose.yml config --no-interpolate --quiet
echo DATASTACK_COMPOSE_CONFIG_PASS
- name: CI-07 isolated BuildKit all three images (no deployment)
run: |
set -eu
builder="datastack-p03-${GITHUB_RUN_ID:-0}-${GITHUB_RUN_ATTEMPT:-1}"
tag="datastack-p03-${GITHUB_SHA:-local}"
cleanup() { docker buildx rm --force "$builder" >/dev/null 2>&1 || true; }
trap cleanup EXIT
docker buildx create --name "$builder" --driver docker-container --use
docker buildx inspect "$builder" --bootstrap
docker buildx build --builder "$builder" --progress=plain --no-cache --load -f docker/Dockerfile.server -t "$tag-ingestion" .
docker buildx build --builder "$builder" --progress=plain --no-cache --load -f docker/Dockerfile.web -t "$tag-web" .
docker buildx build --builder "$builder" --progress=plain --no-cache --load -f docker/Dockerfile.proxy -t "$tag-proxy" .
docker image inspect "$tag-ingestion" "$tag-web" "$tag-proxy" >/dev/null
echo DATASTACK_THREE_IMAGES_BUILD_PASS
security-backport-source-probe:
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.security_probe_only == 'true' }}
runs-on: ubuntu-latest
container: node:22-alpine
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
github-server-url: https://dev.ivib.cc
persist-credentials: false
- name: Inspect locked production package sources in disposable checkout
run: |
set -eu
npm ci --omit=dev --ignore-scripts --no-audit --no-fund
node <<'NODE'
const fs = require('node:fs');
const crypto = require('node:crypto');
const targets = [
['got10', 'node_modules/got/dist/source/request-as-event-emitter.js', /redirectUrl|headers\.location|unix/i],
['glob10', 'node_modules/glob/dist/commonjs/walker.js', /this\.signal.*aborted|walkCB\(/],
['glob13', 'node_modules/onezip/node_modules/glob/dist/commonjs/walker.js', /this\.signal.*aborted|walkCB\(/],
['minimatch9', 'node_modules/glob/node_modules/minimatch/dist/commonjs/index.js', /firstPhasePreProcess|secondPhasePreProcess|globParts\.length|didSomething/],
['minimatch10', 'node_modules/onezip/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js', /firstPhasePreProcess|secondPhasePreProcess|globParts\.length|didSomething/],
['filetype16-join', 'node_modules/join-io/node_modules/ponse/node_modules/file-type/core.js', /tokenizer\.position \+ 24|readHeader\(|await tokenizer\.ignore\(payload\)/],
['filetype16-rest', 'node_modules/restbox/node_modules/ponse/node_modules/file-type/core.js', /tokenizer\.position \+ 24|readHeader\(|await tokenizer\.ignore\(payload\)/],
];
for (const [name,path,re] of targets) {
if (!fs.existsSync(path)) {console.log('PROBE_MISSING', name, path);continue}
const src=fs.readFileSync(path,'utf8'),lines=src.split('\n');
const indices=[];
for(let i=0;i<lines.length;i++)if(re.test(lines[i]))indices.push(i);
console.log('PROBE_FILE',JSON.stringify({name,path,bytes:Buffer.byteLength(src),sha256:crypto.createHash('sha256').update(src).digest('hex'),hits:indices.length}));
for(const i of indices.slice(0, name.startsWith('minimatch') ? 9 : name.startsWith('filetype')?5:11)){
const lo=Math.max(0,i-3),hi=Math.min(lines.length,i+5);
console.log('PROBE_SNIPPET',JSON.stringify({name,line:i+1,range:[lo+1,hi],text:lines.slice(lo,hi).join('\n')}));
}
}
NODE