Skip to content

Add rolling compatibility checks to CI #169

Add rolling compatibility checks to CI

Add rolling compatibility checks to CI #169

name: Deployment automation
on:
pull_request:
paths:
- 'deploy/automation/**'
- 'scripts/check-pypi-package-guard.sh'
- 'scripts/test_python_package_integrity.py'
- '.github/workflows/deployment-automation.yml'
push:
paths:
- 'deploy/automation/**'
- 'scripts/check-pypi-package-guard.sh'
- 'scripts/test_python_package_integrity.py'
- '.github/workflows/deployment-automation.yml'
permissions:
contents: read
env:
GOPROXY: https://golang.flatt.tech
PIP_INDEX_URL: https://pypi.flatt.tech/simple/
PIP_CONFIG_FILE: /dev/null
PIP_EXTRA_INDEX_URL: ''
PIP_FIND_LINKS: ''
jobs:
offline-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up Python with locked wheel support
# actions/setup-python v7.1.0
# Pin an interpreter with wheels for the hash-locked parser dependency.
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0
with:
python-version: '3.15'
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: false
- name: Build the bounded source marker parser
run: |
go build -o "$RUNNER_TEMP/marker-tools/elastickv-go-source-markers" ./deploy/automation/go-source-markers
echo "$RUNNER_TEMP/marker-tools" >> "$GITHUB_PATH"
- name: Create job-local virtual environment
run: |
python3 -m venv "$RUNNER_TEMP/guard-python"
echo "$RUNNER_TEMP/guard-python/bin" >> "$GITHUB_PATH"
- name: Install YAML parser
run: |
python3 -m pip install --require-hashes --only-binary=:all: -r deploy/automation/requirements-ci.lock
- name: Verify PyPI package download protection with an empty cache
run: bash scripts/check-pypi-package-guard.sh
- name: Check Python source
run: |
ruff check --select E4,E7,E9,F,I deploy/automation/*.py scripts/test_python_package_integrity.py
ruff format --check deploy/automation/*.py scripts/test_python_package_integrity.py
- name: Verify Python artifact integrity and portable locks
env:
PYTHONPATH: deploy/automation
run: python3 -m unittest discover -s scripts -p test_python_package_integrity.py -v
- name: Test controllers and render isolated examples
run: python3 -m unittest discover -s deploy/automation -v
controller-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: docker/setup-buildx-action@v4
- name: Build the portable controller without publishing or deploying
uses: docker/build-push-action@v7
with:
context: .
file: deploy/automation/Dockerfile
platforms: linux/amd64
push: false
load: true
tags: elastickv-release-controller:ci
cache-from: type=gha,scope=release-controller
cache-to: type=gha,mode=max,scope=release-controller
- name: Check CLI and runtime imports without credentials
run: |
docker run --rm elastickv-release-controller:ci --help
docker run --rm --entrypoint python3 elastickv-release-controller:ci -c 'import agent, compatibility, source_review, human_approval, boto3, yaml'
- name: Verify trust-root cache on a read-only filesystem
env:
GH_TOKEN: ${{ github.token }}
run: |
docker run --rm --read-only --tmpfs /tmp:rw,nosuid,nodev,size=64m \
-e GH_TOKEN -e GH_CONFIG_DIR=/tmp/gh-provenance -e XDG_CACHE_HOME=/tmp/gh-cache \
--entrypoint gh elastickv-release-controller:ci attestation trusted-root --verify-only
- name: Test the built runtime with its installed dependencies
run: |
docker run --rm --read-only --tmpfs /tmp:rw,nosuid,nodev,size=128m \
-v "$PWD:/repo:ro" -w /repo/deploy/automation -e ELASTICKV_DEPLOYMENT_CONFIG= \
--entrypoint python3 elastickv-release-controller:ci -m unittest discover -v