Skip to content

Commit 909036d

Browse files
committed
chore(merge): merge microsoft/main, drop doc/api.rst (migrated to auto-generated api docs)
2 parents 98f0dcd + 56bd0e6 commit 909036d

1,302 files changed

Lines changed: 128889 additions & 33417 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.azuredevops/end-to-end-tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Runs end-to-end scenario tests using pyrit_scan CLI
2+
3+
trigger: none # Disable automatic CI triggers
4+
5+
schedules:
6+
- cron: "0 7 * * *" # 7 AM UTC = 11 PM PST (UTC-8) / Midnight PDT (UTC-7)
7+
displayName: Nightly E2E Tests at 11 PM PST
8+
branches:
9+
include:
10+
- main
11+
always: true # Run even if there are no code changes
12+
13+
jobs:
14+
- template: test-job-template.yml
15+
parameters:
16+
jobName: EndToEndTests
17+
jobDisplayName: "Run end-to-end scenario tests"
18+
testAzureSubscription: 'integration-test-service-connection'
19+
newDir: e2e_test_directory
20+
testsFolder: end_to_end
21+
makeTarget: end-to-end-test

.azuredevops/integration-tests.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# Builds the pyrit environment and runs integration tests
3+
4+
trigger:
5+
branches:
6+
include:
7+
- main
8+
9+
# There are additional PR triggers for this that are configurable in ADO.
10+
11+
jobs:
12+
- template: test-job-template.yml
13+
parameters:
14+
jobName: IntegrationTests
15+
jobDisplayName: "Builds the pyrit environment and runs integration tests"
16+
testAzureSubscription: 'integration-test-service-connection'
17+
newDir: integration_test_directory
18+
testsFolder: integration
19+
makeTarget: integration-test
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Builds the pyrit environment and runs partner integration tests. Partner integration tests are to ensure that we
2+
# are not breaking any contract between PyRIT and its partners.
3+
trigger: none # Disable automatic CI triggers
4+
5+
schedules:
6+
- cron: "0 6 * * *" # 6 AM UTC = 10 PM PST (UTC-8) / 11PM PDT (UTC-6)
7+
displayName: Nightly Partner Integration Tests at 10 PM PST
8+
branches:
9+
include:
10+
- main
11+
always: true # Run even if there are no code changes
12+
13+
jobs:
14+
- template: test-job-template.yml
15+
parameters:
16+
jobName: PartnerIntegrationTests
17+
jobDisplayName: "Builds the pyrit environment and runs partner integration tests"
18+
testAzureSubscription: 'integration-test-service-connection'
19+
newDir: partner_integration_test_directory
20+
testsFolder: partner_integration
21+
makeTarget: partner-integration-test
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
2-
# Builds the pyrit environment and runs integration tests
3-
4-
trigger:
5-
branches:
6-
include:
7-
- main
8-
9-
# There are additional PR triggers for this that are configurable in ADO.
1+
parameters:
2+
- name: jobName
3+
type: string
4+
- name: jobDisplayName
5+
type: string
6+
- name: testAzureSubscription
7+
type: string
8+
- name: newDir
9+
type: string
10+
- name: testsFolder
11+
type: string
12+
- name: makeTarget
13+
type: string
1014

1115
jobs:
12-
- job: IntegrationTests
13-
displayName: "Builds the pyrit environment and runs integration tests"
14-
timeoutInMinutes: 360 # Allows the job to run up to 6 hours
16+
- job: ${{ parameters.jobName }}
17+
displayName: ${{ parameters.jobDisplayName }}
18+
timeoutInMinutes: 360
1519
pool:
1620
vmImage: ubuntu-latest
1721
steps:
@@ -79,21 +83,21 @@ jobs:
7983
name: install_PyRIT
8084
- bash: df -all -h
8185
name: disk_space_check
82-
# This step ensures that integration tests are run outside of the PyRIT repository to test that .env files are accessed correctly.
86+
# This step ensures that tests are run outside of the PyRIT repository to test that .env files are accessed correctly.
8387
- bash: |
8488
PyRIT_DIR=$(pwd)
85-
NEW_DIR="integration_test_directory"
89+
NEW_DIR="${{ parameters.newDir }}"
8690
cd ..
8791
mkdir -p $NEW_DIR/tests
8892
cp -r $PyRIT_DIR/doc $NEW_DIR
8993
cp -r $PyRIT_DIR/assets $NEW_DIR
90-
cp -r $PyRIT_DIR/tests/integration $NEW_DIR/tests
94+
cp -r $PyRIT_DIR/tests/${{ parameters.testsFolder }} $NEW_DIR/tests
9195
cd $NEW_DIR
92-
displayName: "Create and switch to new integration test directory"
96+
displayName: "Create and switch to new test directory"
9397
- task: AzureCLI@2
9498
displayName: "Authenticate with service principal, cache Cognitive Services access token, and run tests"
9599
inputs:
96-
azureSubscription: 'integration-test-service-connection'
100+
azureSubscription: ${{ parameters.testAzureSubscription }}
97101
scriptType: 'bash'
98102
scriptLocation: 'inlineScript'
99103
inlineScript: |
@@ -109,8 +113,8 @@ jobs:
109113
az account get-access-token --scope https://database.windows.net/.default --output none
110114
echo "Azure SQL Database access token cached successfully."
111115
112-
# Run integration tests
113-
make integration-test
116+
# Run tests
117+
make ${{ parameters.makeTarget }}
114118
- bash: |
115119
rm -f ~/.pyrit/.env ~/.pyrit/.env.local
116120
name: clean_up_env_files

.devcontainer/Dockerfile

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/python:3.11
1+
# syntax=docker/dockerfile:1
2+
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm
23

34
# Makes installation faster
45
ENV UV_COMPILE_BYTECODE=1
6+
ENV DEBIAN_FRONTEND=noninteractive
57

68
SHELL ["/bin/bash", "-c"]
79

@@ -11,66 +13,63 @@ USER root
1113
RUN rm -f /etc/apt/sources.list.d/yarn.list 2>/dev/null || true
1214

1315
# Install required system packages + ODBC prerequisites
14-
RUN apt-get update && apt-get install -y \
15-
sudo \
16-
unixodbc \
17-
unixodbc-dev \
18-
libgl1 \
19-
git \
20-
curl \
21-
xdg-utils \
22-
build-essential \
23-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
16+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
17+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
18+
apt-get update \
19+
&& apt-get install -y --no-install-recommends \
20+
sudo \
21+
unixodbc \
22+
unixodbc-dev \
23+
libgl1 \
24+
git \
25+
curl \
26+
xdg-utils \
27+
build-essential
2428

25-
# Install the Azure CLI, Microsoft ODBC Driver 18 & SQL tools
29+
# Install Microsoft ODBC Driver 18 & SQL tools
2630
# Note: Debian Trixie's sqv rejects SHA1 signatures, so we use gpg directly to import the Microsoft key
27-
RUN apt-get update && apt-get install -y \
28-
apt-transport-https \
31+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
32+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
33+
apt-get update \
34+
&& apt-get install -y --no-install-recommends \
2935
ca-certificates \
3036
gnupg \
31-
lsb-release \
3237
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc \
3338
| gpg --dearmor \
3439
> /usr/share/keyrings/microsoft-archive-keyring.gpg \
35-
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" \
40+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" \
3641
> /etc/apt/sources.list.d/microsoft.list \
3742
&& apt-get update \
38-
&& ACCEPT_EULA=Y apt-get install -y \
43+
&& ACCEPT_EULA=Y apt-get install -y --no-install-recommends \
3944
msodbcsql18 \
40-
mssql-tools \
41-
unixodbc-dev \
42-
&& apt-get install -y azure-cli \
43-
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> /etc/profile.d/sqltools.sh \
44-
&& apt-get clean \
45-
&& rm -rf /var/lib/apt/lists/*
45+
mssql-tools18 \
46+
&& echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> /etc/profile.d/sqltools.sh
4647

4748
# audio back-ends needed by Azure Speech SDK
48-
RUN apt-get update \
49-
&& DEBIAN_FRONTEND=noninteractive \
50-
apt-get install -y --no-install-recommends \
49+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
50+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
51+
apt-get update \
52+
&& apt-get install -y --no-install-recommends \
5153
libasound2 \
52-
libpulse0 \
53-
&& rm -rf /var/lib/apt/lists/*
54+
libpulse0
5455

5556
# Install uv system-wide and create pyrit-dev venv
56-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
57-
&& mv /root/.local/bin/uv /usr/local/bin/uv \
58-
&& rm -rf /opt/venv \
59-
&& uv venv /opt/venv --python 3.11 --prompt pyrit-dev \
60-
&& chown -R vscode:vscode /opt/venv \
61-
&& ls -la /opt/venv/bin/activate
57+
RUN curl -LsSf https://astral.sh/uv/0.10.8/install.sh | sh \
58+
&& mv /root/.local/bin/uv /bin/uv \
59+
&& mv /root/.local/bin/uvx /bin/uvx
60+
RUN uv venv /opt/venv --python 3.11 --prompt pyrit-dev \
61+
&& chown -R vscode:vscode /opt/venv
6262
ENV PATH="/opt/venv/bin:$PATH"
6363

64+
# Install Node.js 24.x LTS for frontend development
65+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
66+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
67+
curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
68+
&& apt-get install -y --no-install-recommends nodejs
69+
6470
# vscode user already exists in the base image, just ensure sudo access
6571
RUN echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
6672

67-
# Install Node.js 20.x and npm for frontend development
68-
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
69-
&& apt-get install -y nodejs \
70-
&& npm install -g npm@latest \
71-
&& apt-get clean \
72-
&& rm -rf /var/lib/apt/lists/*
73-
7473
# Pre-create common user caches and fix permissions
7574
RUN mkdir -p /home/vscode/.cache/pre-commit \
7675
&& mkdir -p /home/vscode/.vscode-server \
@@ -79,7 +78,7 @@ RUN mkdir -p /home/vscode/.cache/pre-commit \
7978
&& mkdir -p /home/vscode/.cache/venv \
8079
&& mkdir -p /home/vscode/.cache/pylance \
8180
&& chown -R vscode:vscode /home/vscode/.cache /home/vscode/.vscode-server \
82-
&& chmod -R 777 /home/vscode/.cache/pip /home/vscode/.cache/pylance /home/vscode/.cache/venv /home/vscode/.cache/uv\
81+
&& chmod -R 755 /home/vscode/.cache/pip /home/vscode/.cache/pylance /home/vscode/.cache/venv /home/vscode/.cache/uv \
8382
&& chmod -R 755 /home/vscode/.vscode-server
8483

8584
USER vscode
@@ -95,6 +94,6 @@ RUN git config --global core.preloadindex true \
9594
&& git config --global status.showUntrackedFiles all \
9695
&& git config --global core.fsmonitor true
9796

98-
# Set cache directories so they can be mounted
97+
# Set cache directories so they can be mounted
9998
ENV PIP_CACHE_DIR="/home/vscode/.cache/pip"
10099
ENV UV_CACHE_DIR="/home/vscode/.cache/uv"

.devcontainer/devcontainer.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,20 @@
8484
"dbaeumer.vscode-eslint",
8585
"esbenp.prettier-vscode",
8686
"ms-playwright.playwright",
87-
"orta.vscode-jest"
87+
"orta.vscode-jest",
88+
"github.copilot",
89+
"github.copilot-chat"
8890
]
8991
}
9092
},
93+
"features": {
94+
"ghcr.io/devcontainers/features/azure-cli:1": {
95+
"version": "latest"
96+
},
97+
"ghcr.io/devcontainers/features/copilot-cli:1": {
98+
"version": "latest"
99+
}
100+
},
91101
"postCreateCommand": "/bin/bash -i .devcontainer/devcontainer_setup.sh",
92102
"forwardPorts": [3000, 4213, 5000, 8000, 8888]
93103
}

.devcontainer/devcontainer_setup.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [ ! -d "$MYPY_CACHE" ]; then
88
echo "Creating mypy cache directory..."
99
sudo mkdir -p $MYPY_CACHE
1010
sudo chown vscode:vscode $MYPY_CACHE
11-
sudo chmod 777 $MYPY_CACHE
11+
sudo chmod 755 $MYPY_CACHE
1212
else
1313
# Check ownership
1414
OWNER=$(stat -c '%U:%G' $MYPY_CACHE)
@@ -21,9 +21,9 @@ else
2121
# Check permissions
2222
PERMS=$(stat -c '%a' $MYPY_CACHE)
2323

24-
if [ "$PERMS" != "777" ]; then
24+
if [ "$PERMS" != "755" ]; then
2525
echo "Fixing mypy cache directory permissions..."
26-
sudo chmod -R 777 $MYPY_CACHE
26+
sudo chmod -R 755 $MYPY_CACHE
2727
fi
2828
fi
2929

@@ -70,6 +70,7 @@ if [ -f "package.json" ]; then
7070
npm install
7171

7272
# Install Playwright browsers and system dependencies for E2E testing
73+
# This may fail if apt repos have signature issues - don't block setup
7374
echo "📦 Installing Playwright browsers..."
7475

7576
# Remove third-party repos with SHA1 signature issues (rejected since 2026-02-01)
@@ -78,7 +79,11 @@ if [ -f "package.json" ]; then
7879
/etc/apt/sources.list.d/nodesource.list \
7980
/etc/apt/sources.list.d/microsoft.list 2>/dev/null || true
8081

81-
npx playwright install --with-deps chromium
82+
if npx playwright install --with-deps chromium; then
83+
echo "✅ Playwright browsers installed."
84+
else
85+
echo "⚠️ Playwright installation failed (apt signature issues). Run 'npx playwright install chromium' manually if needed for E2E tests."
86+
fi
8287

8388
echo "✅ Frontend dependencies installed."
8489
fi

.devcontainer/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
services:
22
devcontainer:
3-
platform: linux/amd64
43
build:
54
context: ..
65
dockerfile: .devcontainer/Dockerfile

0 commit comments

Comments
 (0)