Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/workflows/*.lock.yml linguist-generated=true
9 changes: 9 additions & 0 deletions .github/aw/actions-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"entries": {
"github/gh-aw-actions/setup@v1.2.2": {
"repo": "github/gh-aw-actions/setup",
"version": "v1.2.2",
"sha": "53d0749e19424a918acd82b4d140264ce48f2f14"
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/cosmos-response-contract-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ permissions:
jobs:
cosmos-contracts:
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 45
env:
PYTHONPATH: application/single_app:functional_tests
PYTHONDONTWRITEBYTECODE: '1'
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/model-catalog-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Model catalog publication contracts

on:
pull_request:
paths:
- application/single_app/model_catalog_*.py
- application/single_app/static/json/model_capabilities.json
- application/single_app/static/json/model_catalog*trusted_keys.json
- application/single_app/static/json/schemas/model_capabilities.schema.json
- model-catalog/**
- scripts/publish_model_catalog.py
- scripts/requirements-model-catalog*.txt
- functional_tests/test_model_catalog_publication_lifecycle.py
- .github/workflows/*model-catalog*
- .github/aw/actions-lock.json
workflow_dispatch:

permissions:

Check warning on line 18 in .github/workflows/model-catalog-check.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
contents: read

jobs:
publication-contracts:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

Check warning on line 28 in .github/workflows/model-catalog-check.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- run: python -m pip install -r scripts/requirements-model-catalog-tests.txt

Check warning on line 32 in .github/workflows/model-catalog-check.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains dynamic execution, persistence, or system access marker. Recommendation%3A Do not execute changed lifecycle scripts or installers while this finding is unresolved.
- name: Verify isolation and promotion contracts
run: python -m pytest -q functional_tests/test_model_catalog_publication_lifecycle.py
- name: Verify compiled weekly workflow is current
env:
GH_TOKEN: ${{ github.token }}

Check warning on line 37 in .github/workflows/model-catalog-check.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.
run: |
gh extension install github/gh-aw --pin v1.2.2
gh aw compile refresh-model-catalog --no-check-update --no-logo
git diff --exit-code -- .github/workflows/refresh-model-catalog.lock.yml .github/aw/actions-lock.json
143 changes: 143 additions & 0 deletions .github/workflows/publish-model-catalog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Publish model catalog

on:
push:
branches: [Development, Staging, main]
paths:
- application/single_app/static/json/model_capabilities.json
- application/single_app/static/json/model_catalog_trusted_keys.json
- application/single_app/static/json/model_catalog_development_trusted_keys.json
- model-catalog/release.json
workflow_dispatch:

permissions:

Check warning on line 13 in .github/workflows/publish-model-catalog.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
contents: read

concurrency:
group: publish-model-catalog-${{ github.ref_name }}
cancel-in-progress: false

jobs:
prepare:
if: github.repository == 'microsoft/simplechat' && contains(fromJSON('["Development", "Staging", "main"]'), github.ref_name)
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
channel: ${{ steps.policy.outputs.channel }}

Check warning on line 26 in .github/workflows/publish-model-catalog.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
environment: ${{ steps.policy.outputs.environment }}

Check warning on line 27 in .github/workflows/publish-model-catalog.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.

Check warning on line 27 in .github/workflows/publish-model-catalog.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.
app_version: ${{ steps.policy.outputs.app_version }}

Check warning on line 28 in .github/workflows/publish-model-catalog.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains security control, sanitization, or audit marker. Recommendation%3A Confirm the change does not weaken auth, CSRF, CSP, XSS defenses, settings sanitization, redaction, audit logging, or tests.
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false

Check warning on line 33 in .github/workflows/publish-model-catalog.yml

View workflow job for this annotation

GitHub Actions / malicious-pr-security-review

Important - Changed line contains secret or sensitive data source marker. Recommendation%3A Pair this source with any nearby network, logging, serialization, or process execution sink before approving.
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'
- run: python -m pip install -r scripts/requirements-model-catalog.txt
- name: Select fixed publishing policy
id: policy
env:
SOURCE_BRANCH: ${{ github.ref_name }}
run: |
case "$SOURCE_BRANCH" in
main) echo "channel=production" >> "$GITHUB_OUTPUT"; echo "environment=model-catalog-publishing" >> "$GITHUB_OUTPUT" ;;
Development) echo "channel=development" >> "$GITHUB_OUTPUT"; echo "environment=model-catalog-development" >> "$GITHUB_OUTPUT" ;;
Staging) echo "channel=development" >> "$GITHUB_OUTPUT"; echo "environment=model-catalog-validation" >> "$GITHUB_OUTPUT" ;;
*) exit 1 ;;
esac
version="$(python -c 'import ast,pathlib; t=ast.parse(pathlib.Path("application/single_app/config.py").read_text()); print(next(ast.literal_eval(n.value) for n in t.body if isinstance(n,ast.Assign) and any(isinstance(v,ast.Name) and v.id=="VERSION" for v in n.targets)))')"
echo "app_version=$version" >> "$GITHUB_OUTPUT"
- name: Validate and prepare reviewed source
env:
SOURCE_COMMIT: ${{ github.sha }}
GH_TOKEN: ${{ github.token }}
CHANNEL: ${{ steps.policy.outputs.channel }}
run: |
python scripts/publish_model_catalog.py prepare --channel "$CHANNEL" --source-commit "$SOURCE_COMMIT" --output candidate
cat candidate/candidate.json >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: catalog-candidate
path: candidate/
retention-days: 7
if-no-files-found: error

sign-and-publish:
needs: prepare
if: github.ref_name == 'Development' || github.ref_name == 'main'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: ${{ needs.prepare.outputs.environment }}
permissions:
id-token: write
contents: write
actions: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: catalog-candidate
path: candidate
- name: Require publishing configuration
env:
KEY_ID: ${{ vars.CATALOG_KEY_ID }}
KEY_URL: ${{ vars.CATALOG_VAULT_KEY_URL }}
run: |
test -n "$KEY_ID" && test -n "$KEY_URL"
- uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
with:
client-id: ${{ vars.CATALOG_AZURE_CLIENT_ID }}
tenant-id: ${{ vars.CATALOG_AZURE_TENANT_ID }}
subscription-id: ${{ vars.CATALOG_AZURE_SUBSCRIPTION_ID }}
- run: python -m pip install -r scripts/requirements-model-catalog.txt
- name: Sign, verify and publish
env:
GH_TOKEN: ${{ github.token }}
CATALOG_KEY_ID: ${{ vars.CATALOG_KEY_ID }}
CATALOG_VAULT_KEY_URL: ${{ vars.CATALOG_VAULT_KEY_URL }}
CATALOG_APP_VERSION: ${{ needs.prepare.outputs.app_version }}
CHANNEL: ${{ needs.prepare.outputs.channel }}
run: |
python scripts/publish_model_catalog.py sign-publish --channel "$CHANNEL" --output candidate
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: signed-model-catalog-${{ needs.prepare.outputs.channel }}
path: candidate/catalog-*.json
retention-days: 30
if-no-files-found: error

validate-for-production:
needs: prepare
if: github.ref_name == 'Staging'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: model-catalog-validation
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: catalog-candidate
path: candidate
- run: python -m pip install -r scripts/requirements-model-catalog-tests.txt
- name: Exercise channel and promotion contracts
run: python -m pytest -q functional_tests/test_model_catalog_publication_lifecycle.py
- name: Attest the approved Staging test
env:
GH_TOKEN: ${{ github.token }}
CATALOG_APP_VERSION: ${{ needs.prepare.outputs.app_version }}
run: python scripts/publish_model_catalog.py record-validation --channel development --output candidate
Loading
Loading