src-auth-perms-sync 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- src_auth_perms_sync-0.2.2/.github/workflows/ci.yml +17 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/.github/workflows/release.yml +104 -33
- src_auth_perms_sync-0.2.2/.github/workflows/validate.yml +265 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/.gitignore +1 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/AGENTS.md +10 -3
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/PKG-INFO +15 -2
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/README.md +13 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/dev/TODO.md +5 -0
- src_auth_perms_sync-0.2.2/dev/sourcegraph-explicit-permissions-tracing.md +289 -0
- src_auth_perms_sync-0.2.1/dev/test-command-permutations.py → src_auth_perms_sync-0.2.2/dev/test-end-to-end.py +812 -296
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/pyproject.toml +2 -2
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/cli.py +8 -48
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/apply.py +5 -5
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/command.py +3 -3
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/full_set.py +2 -2
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/mapping.py +4 -3
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/maps.py +2 -2
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/snapshot.py +9 -9
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/sourcegraph.py +1 -2
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/workflow.py +3 -3
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/unit/test_cli_config.py +22 -21
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/unit/test_restore.py +5 -4
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/unit/test_snapshot.py +11 -11
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/uv.lock +5 -5
- src_auth_perms_sync-0.2.1/.github/workflows/ci.yml +0 -77
- src_auth_perms_sync-0.2.1/src/src_auth_perms_sync/shared/id_codec.py +0 -67
- src_auth_perms_sync-0.2.1/tests/unit/test_id_codec.py +0 -26
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/.env.example +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/.markdownlint-cli2.yaml +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/.python-version +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/LICENSE +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/SECURITY.md +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/dev/dead-code-audit.md +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/dev/git-worktrees.md +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/dev/hooks/pre-commit +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/dev/python-versions.md +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/dev/test-plan.md +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/maps-example.yaml +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/renovate.json +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/__init__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/__main__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/orgs/__init__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/orgs/command.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/orgs/queries.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/orgs/sync.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/orgs/types.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/__init__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/queries.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/restore.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/permissions/types.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/__init__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/backups.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/queries.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/run_context.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/saml_groups.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/site_config.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/sourcegraph.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/src/src_auth_perms_sync/shared/types.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/__init__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/integration/__init__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/integration/test_cli_entrypoint.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/unit/__init__.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/unit/test_backups.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/unit/test_maps.py +0 -0
- {src_auth_perms_sync-0.2.1 → src_auth_perms_sync-0.2.2}/tests/unit/test_saml_groups.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
pull-requests: read
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
validate:
|
|
16
|
+
name: Validate
|
|
17
|
+
uses: ./.github/workflows/validate.yml
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: Build
|
|
1
|
+
name: Build release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -13,6 +13,7 @@ on:
|
|
|
13
13
|
|
|
14
14
|
permissions:
|
|
15
15
|
contents: write
|
|
16
|
+
pull-requests: read
|
|
16
17
|
|
|
17
18
|
concurrency:
|
|
18
19
|
group: release-${{ github.event.inputs.tag || github.ref_name }}
|
|
@@ -23,13 +24,18 @@ defaults:
|
|
|
23
24
|
shell: bash
|
|
24
25
|
|
|
25
26
|
jobs:
|
|
27
|
+
validate:
|
|
28
|
+
name: Validate
|
|
29
|
+
uses: ./.github/workflows/validate.yml
|
|
30
|
+
with:
|
|
31
|
+
ref: ${{ github.event.inputs.tag || github.ref }}
|
|
32
|
+
build-package: false
|
|
33
|
+
|
|
26
34
|
wheelhouse:
|
|
27
35
|
name: ${{ matrix.platform }}-py311 wheelhouse
|
|
28
36
|
runs-on: ${{ matrix.runs_on }}
|
|
29
37
|
strategy:
|
|
30
38
|
fail-fast: false
|
|
31
|
-
# The first matrix leg creates the release; later legs upload more assets.
|
|
32
|
-
max-parallel: 1
|
|
33
39
|
matrix:
|
|
34
40
|
include:
|
|
35
41
|
- platform: linux-x86_64
|
|
@@ -61,12 +67,17 @@ jobs:
|
|
|
61
67
|
uses: actions/setup-python@v6
|
|
62
68
|
with:
|
|
63
69
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
64
|
-
|
|
70
|
+
|
|
71
|
+
- name: Cache uv
|
|
72
|
+
uses: actions/cache@v5
|
|
73
|
+
with:
|
|
74
|
+
path: ~/.cache/uv
|
|
75
|
+
key: uv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('uv.lock') }}
|
|
76
|
+
restore-keys: |
|
|
77
|
+
uv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-
|
|
65
78
|
|
|
66
79
|
- name: Install build tools
|
|
67
|
-
run:
|
|
68
|
-
python -m pip install --upgrade pip
|
|
69
|
-
python -m pip install "uv==${UV_VERSION}"
|
|
80
|
+
run: python -m pip install "uv==${UV_VERSION}"
|
|
70
81
|
|
|
71
82
|
- name: Validate release inputs
|
|
72
83
|
id: release
|
|
@@ -103,7 +114,7 @@ jobs:
|
|
|
103
114
|
|
|
104
115
|
echo "tag=${release_tag}" >> "${GITHUB_OUTPUT}"
|
|
105
116
|
|
|
106
|
-
- name: Validate
|
|
117
|
+
- name: Validate runner architecture
|
|
107
118
|
run: |
|
|
108
119
|
actual_machine=$(uv run --frozen python - <<'PY'
|
|
109
120
|
import platform
|
|
@@ -116,12 +127,6 @@ jobs:
|
|
|
116
127
|
exit 1
|
|
117
128
|
fi
|
|
118
129
|
|
|
119
|
-
uv lock --check
|
|
120
|
-
uv run --frozen ruff check src/src_auth_perms_sync/
|
|
121
|
-
uv run --frozen ruff format --check src/src_auth_perms_sync/
|
|
122
|
-
uv run --frozen pyright
|
|
123
|
-
uv run --frozen src-auth-perms-sync --help >/tmp/src-auth-perms-sync-help.txt
|
|
124
|
-
|
|
125
130
|
- name: Build wheelhouse tarball
|
|
126
131
|
id: build
|
|
127
132
|
run: |
|
|
@@ -136,15 +141,25 @@ jobs:
|
|
|
136
141
|
|
|
137
142
|
rm -rf build/release
|
|
138
143
|
mkdir -p "${wheelhouse_dir}" "${dist_dir}"
|
|
144
|
+
shopt -s nullglob
|
|
139
145
|
|
|
140
|
-
uv build --wheel --out-dir "${dist_dir}" --no-create-gitignore
|
|
146
|
+
uv build --wheel --sdist --out-dir "${dist_dir}" --no-create-gitignore
|
|
141
147
|
project_wheels=("${dist_dir}"/*.whl)
|
|
142
148
|
if [[ "${#project_wheels[@]}" -ne 1 ]]; then
|
|
143
149
|
echo "::error title=Unexpected wheel count::Expected one project wheel, found ${#project_wheels[@]}."
|
|
144
150
|
exit 1
|
|
145
151
|
fi
|
|
152
|
+
project_source_distributions=("${dist_dir}"/*.tar.gz)
|
|
153
|
+
if [[ "${#project_source_distributions[@]}" -ne 1 ]]; then
|
|
154
|
+
echo "::error title=Unexpected source distribution count::Expected one project source distribution, found ${#project_source_distributions[@]}."
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
146
157
|
project_wheel_path="${project_wheels[0]}"
|
|
147
158
|
project_wheel_name="$(basename "${project_wheel_path}")"
|
|
159
|
+
project_source_distribution_path="${project_source_distributions[0]}"
|
|
160
|
+
project_source_distribution_name="$(basename "${project_source_distribution_path}")"
|
|
161
|
+
project_wheel_checksum_path="${project_wheel_path}.sha256"
|
|
162
|
+
project_source_distribution_checksum_path="${project_source_distribution_path}.sha256"
|
|
148
163
|
if [[ ! -f "${project_wheel_path}" ]]; then
|
|
149
164
|
echo "::error title=Missing project wheel::Expected ${project_wheel_path} to exist."
|
|
150
165
|
exit 1
|
|
@@ -197,7 +212,7 @@ jobs:
|
|
|
197
212
|
pip install "https://github.com/sourcegraph/src-auth-perms-sync/releases/download/${release_tag}/${project_wheel_name}"
|
|
198
213
|
EOF
|
|
199
214
|
|
|
200
|
-
(cd "${wheelhouse_dir}" && shasum -a 256
|
|
215
|
+
(cd "${wheelhouse_dir}" && shasum -a 256 ./*.whl > WHEELS.sha256)
|
|
201
216
|
|
|
202
217
|
test -f "${project_wheel_path}"
|
|
203
218
|
test -f "${wheelhouse_dir}"/src_auth_perms_sync-*.whl
|
|
@@ -211,16 +226,28 @@ jobs:
|
|
|
211
226
|
exit 1
|
|
212
227
|
fi
|
|
213
228
|
|
|
229
|
+
(
|
|
230
|
+
cd "$(dirname "${project_wheel_path}")"
|
|
231
|
+
shasum -a 256 "${project_wheel_name}" > "$(basename "${project_wheel_checksum_path}")"
|
|
232
|
+
shasum -a 256 "${project_source_distribution_name}" > "$(basename "${project_source_distribution_checksum_path}")"
|
|
233
|
+
)
|
|
234
|
+
|
|
214
235
|
tar -C "${release_dir}" -czf "${asset_path}" wheelhouse
|
|
215
236
|
(
|
|
216
237
|
cd "$(dirname "${asset_path}")"
|
|
217
238
|
shasum -a 256 "$(basename "${asset_path}")" > "$(basename "${checksum_path}")"
|
|
218
239
|
)
|
|
219
240
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
241
|
+
{
|
|
242
|
+
echo "asset_path=${asset_path}"
|
|
243
|
+
echo "checksum_path=${checksum_path}"
|
|
244
|
+
echo "project_wheel_path=${project_wheel_path}"
|
|
245
|
+
echo "project_wheel_name=${project_wheel_name}"
|
|
246
|
+
echo "project_source_distribution_path=${project_source_distribution_path}"
|
|
247
|
+
echo "project_source_distribution_name=${project_source_distribution_name}"
|
|
248
|
+
echo "project_wheel_checksum_path=${project_wheel_checksum_path}"
|
|
249
|
+
echo "project_source_distribution_checksum_path=${project_source_distribution_checksum_path}"
|
|
250
|
+
} >> "${GITHUB_OUTPUT}"
|
|
224
251
|
|
|
225
252
|
- name: Validate offline install from tarball
|
|
226
253
|
run: |
|
|
@@ -244,6 +271,7 @@ jobs:
|
|
|
244
271
|
run: |
|
|
245
272
|
release_tag="${{ steps.release.outputs.tag }}"
|
|
246
273
|
project_wheel_name="${{ steps.build.outputs.project_wheel_name }}"
|
|
274
|
+
project_source_distribution_name="${{ steps.build.outputs.project_source_distribution_name }}"
|
|
247
275
|
notes_path="build/release/release-notes.md"
|
|
248
276
|
cat > "${notes_path}" <<EOF
|
|
249
277
|
## Customer install
|
|
@@ -273,7 +301,9 @@ jobs:
|
|
|
273
301
|
\`\`\`
|
|
274
302
|
|
|
275
303
|
The tarball includes this project, \`src-py-lib\`, and all runtime wheels.
|
|
276
|
-
Verify the
|
|
304
|
+
Verify the tarball downloads with the matching \`.sha256\` files.
|
|
305
|
+
The GitHub release also includes the same \`${project_wheel_name}\` and
|
|
306
|
+
\`${project_source_distribution_name}\` files uploaded to PyPI, plus matching checksums.
|
|
277
307
|
|
|
278
308
|
### Connected PyPI install
|
|
279
309
|
|
|
@@ -296,29 +326,69 @@ jobs:
|
|
|
296
326
|
path: |
|
|
297
327
|
${{ steps.build.outputs.asset_path }}
|
|
298
328
|
${{ steps.build.outputs.checksum_path }}
|
|
329
|
+
|
|
330
|
+
- name: Upload project distribution release artifact
|
|
331
|
+
if: matrix.platform == 'linux-x86_64'
|
|
332
|
+
uses: actions/upload-artifact@v7
|
|
333
|
+
with:
|
|
334
|
+
name: src-auth-perms-sync-project-distributions
|
|
335
|
+
path: |
|
|
299
336
|
${{ steps.build.outputs.project_wheel_path }}
|
|
300
|
-
${{ steps.
|
|
337
|
+
${{ steps.build.outputs.project_source_distribution_path }}
|
|
338
|
+
${{ steps.build.outputs.project_wheel_checksum_path }}
|
|
339
|
+
${{ steps.build.outputs.project_source_distribution_checksum_path }}
|
|
340
|
+
|
|
341
|
+
- name: Upload release notes artifact
|
|
342
|
+
if: matrix.platform == 'linux-x86_64'
|
|
343
|
+
uses: actions/upload-artifact@v7
|
|
344
|
+
with:
|
|
345
|
+
name: release-notes
|
|
346
|
+
path: ${{ steps.notes.outputs.path }}
|
|
301
347
|
|
|
302
348
|
- name: Upload PyPI artifact
|
|
303
349
|
if: matrix.platform == 'linux-x86_64'
|
|
304
350
|
uses: actions/upload-artifact@v7
|
|
305
351
|
with:
|
|
306
352
|
name: pypi-distributions
|
|
307
|
-
path:
|
|
353
|
+
path: |
|
|
354
|
+
${{ steps.build.outputs.project_wheel_path }}
|
|
355
|
+
${{ steps.build.outputs.project_source_distribution_path }}
|
|
356
|
+
|
|
357
|
+
github-release:
|
|
358
|
+
name: Publish GitHub release assets
|
|
359
|
+
needs: [validate, wheelhouse]
|
|
360
|
+
runs-on: ubuntu-24.04
|
|
361
|
+
|
|
362
|
+
steps:
|
|
363
|
+
- name: Download wheelhouse artifacts
|
|
364
|
+
uses: actions/download-artifact@v7
|
|
365
|
+
with:
|
|
366
|
+
pattern: src-auth-perms-sync-*
|
|
367
|
+
path: release-assets
|
|
368
|
+
merge-multiple: true
|
|
369
|
+
|
|
370
|
+
- name: Download release notes
|
|
371
|
+
uses: actions/download-artifact@v7
|
|
372
|
+
with:
|
|
373
|
+
name: release-notes
|
|
374
|
+
path: release-notes
|
|
308
375
|
|
|
309
376
|
- name: Publish GitHub release assets
|
|
310
377
|
env:
|
|
311
378
|
GH_TOKEN: ${{ github.token }}
|
|
379
|
+
GH_REPO: ${{ github.repository }}
|
|
312
380
|
run: |
|
|
313
|
-
release_tag="${{
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
381
|
+
release_tag="${{ github.event.inputs.tag || github.ref_name }}"
|
|
382
|
+
notes_path="$(find release-notes -name release-notes.md -print -quit)"
|
|
383
|
+
mapfile -t release_assets < <(find release-assets -type f | sort)
|
|
384
|
+
|
|
385
|
+
if [[ -z "${notes_path}" ]]; then
|
|
386
|
+
echo "::error title=Missing release notes::release-notes.md was not found in release artifact."
|
|
387
|
+
exit 1
|
|
388
|
+
fi
|
|
389
|
+
if [[ "${#release_assets[@]}" -eq 0 ]]; then
|
|
390
|
+
echo "::error title=Missing release assets::No release assets were downloaded."
|
|
391
|
+
exit 1
|
|
322
392
|
fi
|
|
323
393
|
|
|
324
394
|
if gh release view "${release_tag}" >/dev/null 2>&1; then
|
|
@@ -334,7 +404,7 @@ jobs:
|
|
|
334
404
|
|
|
335
405
|
pypi:
|
|
336
406
|
name: Publish PyPI package
|
|
337
|
-
needs: wheelhouse
|
|
407
|
+
needs: [validate, wheelhouse]
|
|
338
408
|
runs-on: ubuntu-24.04
|
|
339
409
|
permissions:
|
|
340
410
|
contents: read
|
|
@@ -354,3 +424,4 @@ jobs:
|
|
|
354
424
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
355
425
|
with:
|
|
356
426
|
packages-dir: dist
|
|
427
|
+
skip-existing: true
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
name: Validate
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
ref:
|
|
7
|
+
description: "Git ref to validate. Defaults to the caller's ref."
|
|
8
|
+
required: false
|
|
9
|
+
type: string
|
|
10
|
+
build-package:
|
|
11
|
+
description: "Build and smoke-test package artifacts. Release builds do this separately."
|
|
12
|
+
required: false
|
|
13
|
+
type: boolean
|
|
14
|
+
default: true
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
pull-requests: read
|
|
19
|
+
|
|
20
|
+
defaults:
|
|
21
|
+
run:
|
|
22
|
+
shell: bash
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
changes:
|
|
26
|
+
name: Detect changed paths
|
|
27
|
+
runs-on: ubuntu-24.04
|
|
28
|
+
outputs:
|
|
29
|
+
github_actions: ${{ steps.changed_paths.outputs.github_actions }}
|
|
30
|
+
markdown: ${{ steps.changed_paths.outputs.markdown }}
|
|
31
|
+
python: ${{ steps.changed_paths.outputs.python }}
|
|
32
|
+
package: ${{ steps.changed_paths.outputs.package }}
|
|
33
|
+
|
|
34
|
+
steps:
|
|
35
|
+
- name: Detect changed paths
|
|
36
|
+
id: changed_paths
|
|
37
|
+
env:
|
|
38
|
+
GH_TOKEN: ${{ github.token }}
|
|
39
|
+
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
|
|
40
|
+
run: |
|
|
41
|
+
github_actions_changed=false
|
|
42
|
+
markdown_changed=false
|
|
43
|
+
python_changed=false
|
|
44
|
+
package_changed=false
|
|
45
|
+
|
|
46
|
+
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
|
|
47
|
+
github_actions_changed=true
|
|
48
|
+
markdown_changed=true
|
|
49
|
+
python_changed=true
|
|
50
|
+
package_changed=true
|
|
51
|
+
else
|
|
52
|
+
changed_files="$(mktemp)"
|
|
53
|
+
gh api --paginate \
|
|
54
|
+
"repos/${GITHUB_REPOSITORY}/pulls/${PULL_REQUEST_NUMBER}/files" \
|
|
55
|
+
--jq '.[].filename' > "${changed_files}"
|
|
56
|
+
|
|
57
|
+
while IFS= read -r changed_file; do
|
|
58
|
+
case "${changed_file}" in
|
|
59
|
+
.github/workflows/*)
|
|
60
|
+
github_actions_changed=true
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
|
|
64
|
+
case "${changed_file}" in
|
|
65
|
+
*.md|.markdownlint-cli2.yaml)
|
|
66
|
+
markdown_changed=true
|
|
67
|
+
;;
|
|
68
|
+
esac
|
|
69
|
+
|
|
70
|
+
case "${changed_file}" in
|
|
71
|
+
.python-version|pyproject.toml|uv.lock|dev/*|src/*|tests/*)
|
|
72
|
+
python_changed=true
|
|
73
|
+
;;
|
|
74
|
+
esac
|
|
75
|
+
|
|
76
|
+
case "${changed_file}" in
|
|
77
|
+
.python-version|LICENSE|README.md|maps-example.yaml|pyproject.toml|uv.lock|src/*)
|
|
78
|
+
package_changed=true
|
|
79
|
+
;;
|
|
80
|
+
esac
|
|
81
|
+
done < "${changed_files}"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
{
|
|
85
|
+
echo "github_actions=${github_actions_changed}"
|
|
86
|
+
echo "markdown=${markdown_changed}"
|
|
87
|
+
echo "python=${python_changed}"
|
|
88
|
+
echo "package=${package_changed}"
|
|
89
|
+
} >> "${GITHUB_OUTPUT}"
|
|
90
|
+
|
|
91
|
+
github_actions:
|
|
92
|
+
name: Lint GitHub Actions
|
|
93
|
+
needs: changes
|
|
94
|
+
if: needs.changes.outputs.github_actions == 'true'
|
|
95
|
+
runs-on: ubuntu-24.04
|
|
96
|
+
env:
|
|
97
|
+
ACTIONLINT_VERSION: "1.7.12"
|
|
98
|
+
|
|
99
|
+
steps:
|
|
100
|
+
- name: Check out code
|
|
101
|
+
uses: actions/checkout@v6
|
|
102
|
+
with:
|
|
103
|
+
persist-credentials: false
|
|
104
|
+
ref: ${{ inputs.ref || github.ref }}
|
|
105
|
+
|
|
106
|
+
- name: Install actionlint
|
|
107
|
+
run: |
|
|
108
|
+
mkdir -p "${HOME}/.local/bin"
|
|
109
|
+
asset="actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
|
|
110
|
+
checksums="actionlint_${ACTIONLINT_VERSION}_checksums.txt"
|
|
111
|
+
base_url="https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}"
|
|
112
|
+
|
|
113
|
+
curl -fsSLO "${base_url}/${asset}"
|
|
114
|
+
curl -fsSLO "${base_url}/${checksums}"
|
|
115
|
+
grep " ${asset}$" "${checksums}" | sha256sum --check
|
|
116
|
+
tar -xzf "${asset}" -C "${HOME}/.local/bin" actionlint
|
|
117
|
+
chmod 0755 "${HOME}/.local/bin/actionlint"
|
|
118
|
+
|
|
119
|
+
- name: Lint GitHub Actions
|
|
120
|
+
run: |
|
|
121
|
+
"${HOME}/.local/bin/actionlint"
|
|
122
|
+
|
|
123
|
+
markdown:
|
|
124
|
+
name: Lint Markdown
|
|
125
|
+
needs: changes
|
|
126
|
+
if: needs.changes.outputs.markdown == 'true'
|
|
127
|
+
runs-on: ubuntu-24.04
|
|
128
|
+
env:
|
|
129
|
+
MARKDOWNLINT_CLI2_VERSION: "0.22.1"
|
|
130
|
+
|
|
131
|
+
steps:
|
|
132
|
+
- name: Check out code
|
|
133
|
+
uses: actions/checkout@v6
|
|
134
|
+
with:
|
|
135
|
+
persist-credentials: false
|
|
136
|
+
ref: ${{ inputs.ref || github.ref }}
|
|
137
|
+
|
|
138
|
+
- name: Cache npm
|
|
139
|
+
uses: actions/cache@v5
|
|
140
|
+
with:
|
|
141
|
+
path: ~/.npm
|
|
142
|
+
key: npm-${{ runner.os }}-markdownlint-cli2-${{ env.MARKDOWNLINT_CLI2_VERSION }}
|
|
143
|
+
|
|
144
|
+
- name: Lint Markdown
|
|
145
|
+
run: npx --yes "markdownlint-cli2@${MARKDOWNLINT_CLI2_VERSION}"
|
|
146
|
+
|
|
147
|
+
python:
|
|
148
|
+
name: Validate Python
|
|
149
|
+
needs: changes
|
|
150
|
+
if: needs.changes.outputs.python == 'true'
|
|
151
|
+
runs-on: ubuntu-24.04
|
|
152
|
+
env:
|
|
153
|
+
PYTHON_VERSION: "3.11"
|
|
154
|
+
UV_VERSION: "0.11.7"
|
|
155
|
+
|
|
156
|
+
steps:
|
|
157
|
+
- name: Check out code
|
|
158
|
+
uses: actions/checkout@v6
|
|
159
|
+
with:
|
|
160
|
+
persist-credentials: false
|
|
161
|
+
ref: ${{ inputs.ref || github.ref }}
|
|
162
|
+
|
|
163
|
+
- name: Set up Python
|
|
164
|
+
uses: actions/setup-python@v6
|
|
165
|
+
with:
|
|
166
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
167
|
+
|
|
168
|
+
- name: Cache uv
|
|
169
|
+
uses: actions/cache@v5
|
|
170
|
+
with:
|
|
171
|
+
path: ~/.cache/uv
|
|
172
|
+
key: uv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('uv.lock') }}
|
|
173
|
+
restore-keys: |
|
|
174
|
+
uv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-
|
|
175
|
+
|
|
176
|
+
- name: Install uv
|
|
177
|
+
run: python -m pip install "uv==${UV_VERSION}"
|
|
178
|
+
|
|
179
|
+
- name: Validate lockfile
|
|
180
|
+
run: uv lock --check
|
|
181
|
+
|
|
182
|
+
- name: Lint Python
|
|
183
|
+
run: uv run --frozen ruff check .
|
|
184
|
+
|
|
185
|
+
- name: Check Python formatting
|
|
186
|
+
run: uv run --frozen ruff format --check .
|
|
187
|
+
|
|
188
|
+
- name: Type check
|
|
189
|
+
run: uv run --frozen pyright
|
|
190
|
+
|
|
191
|
+
- name: Run tests
|
|
192
|
+
run: uv run --frozen python -m unittest discover -s tests
|
|
193
|
+
|
|
194
|
+
- name: Smoke test source checkout CLI
|
|
195
|
+
run: uv run --frozen src-auth-perms-sync --help >/tmp/src-auth-perms-sync-help.txt
|
|
196
|
+
|
|
197
|
+
package_build:
|
|
198
|
+
name: Build and smoke-test package
|
|
199
|
+
needs: changes
|
|
200
|
+
if: inputs.build-package && needs.changes.outputs.package == 'true'
|
|
201
|
+
runs-on: ubuntu-24.04
|
|
202
|
+
env:
|
|
203
|
+
PACKAGE_NAME: src-auth-perms-sync
|
|
204
|
+
PYTHON_VERSION: "3.11"
|
|
205
|
+
UV_VERSION: "0.11.7"
|
|
206
|
+
|
|
207
|
+
steps:
|
|
208
|
+
- name: Check out code
|
|
209
|
+
uses: actions/checkout@v6
|
|
210
|
+
with:
|
|
211
|
+
persist-credentials: false
|
|
212
|
+
ref: ${{ inputs.ref || github.ref }}
|
|
213
|
+
|
|
214
|
+
- name: Set up Python
|
|
215
|
+
uses: actions/setup-python@v6
|
|
216
|
+
with:
|
|
217
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
218
|
+
|
|
219
|
+
- name: Cache uv
|
|
220
|
+
uses: actions/cache@v5
|
|
221
|
+
with:
|
|
222
|
+
path: ~/.cache/uv
|
|
223
|
+
key: uv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('uv.lock') }}
|
|
224
|
+
restore-keys: |
|
|
225
|
+
uv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-
|
|
226
|
+
|
|
227
|
+
- name: Install uv
|
|
228
|
+
run: python -m pip install "uv==${UV_VERSION}"
|
|
229
|
+
|
|
230
|
+
- name: Build wheel
|
|
231
|
+
run: uv build --wheel --out-dir dist --no-create-gitignore
|
|
232
|
+
|
|
233
|
+
- name: Smoke test installed wheel
|
|
234
|
+
run: |
|
|
235
|
+
python -m venv build/ci-venv
|
|
236
|
+
. build/ci-venv/bin/activate
|
|
237
|
+
python -m pip install dist/src_auth_perms_sync-*.whl
|
|
238
|
+
src-auth-perms-sync --help >/tmp/src-auth-perms-sync-installed-help.txt
|
|
239
|
+
python -m src_auth_perms_sync --help >/tmp/src-auth-perms-sync-module-help.txt
|
|
240
|
+
|
|
241
|
+
package:
|
|
242
|
+
name: Validate package
|
|
243
|
+
needs: [changes, github_actions, markdown, python, package_build]
|
|
244
|
+
if: always()
|
|
245
|
+
runs-on: ubuntu-24.04
|
|
246
|
+
|
|
247
|
+
steps:
|
|
248
|
+
- name: Confirm validation results
|
|
249
|
+
run: |
|
|
250
|
+
for validation_result in \
|
|
251
|
+
"${{ needs.changes.result }}" \
|
|
252
|
+
"${{ needs.github_actions.result }}" \
|
|
253
|
+
"${{ needs.markdown.result }}" \
|
|
254
|
+
"${{ needs.python.result }}" \
|
|
255
|
+
"${{ needs.package_build.result }}"
|
|
256
|
+
do
|
|
257
|
+
case "${validation_result}" in
|
|
258
|
+
success|skipped)
|
|
259
|
+
;;
|
|
260
|
+
*)
|
|
261
|
+
echo "::error title=Validation failed::At least one validation job ended with '${validation_result}'."
|
|
262
|
+
exit 1
|
|
263
|
+
;;
|
|
264
|
+
esac
|
|
265
|
+
done
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
## Linting
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
+
### GitHub Actions workflows
|
|
7
|
+
actionlint
|
|
8
|
+
|
|
6
9
|
### Markdown files
|
|
7
|
-
npx --yes markdownlint-cli2
|
|
10
|
+
npx --yes markdownlint-cli2@0.22.1
|
|
8
11
|
|
|
9
12
|
### Python files
|
|
10
13
|
|
|
@@ -44,6 +47,9 @@ uv run src-auth-perms-sync --restore backups/<source>/<run>/before.json
|
|
|
44
47
|
- The tagged source commit must already contain the package version it
|
|
45
48
|
releases. Do not make the customer release workflow edit `pyproject.toml`.
|
|
46
49
|
- Prepare the version bump on a branch. Set `VERSION`, then copy / paste:
|
|
50
|
+
- As part of every release bump, find old release-version literals in
|
|
51
|
+
`AGENTS.md`, `README.md`, and release snippets, and replace them with the
|
|
52
|
+
new version where they are meant to stay current.
|
|
47
53
|
|
|
48
54
|
```bash
|
|
49
55
|
set -euo pipefail
|
|
@@ -84,12 +90,13 @@ uv lock
|
|
|
84
90
|
set -euo pipefail
|
|
85
91
|
|
|
86
92
|
uv lock --check
|
|
93
|
+
actionlint
|
|
87
94
|
uv run ruff check src/src_auth_perms_sync/ tests/
|
|
88
95
|
uv run ruff format --check src/src_auth_perms_sync/ tests/
|
|
89
96
|
uv run pyright
|
|
90
97
|
uv run python -m unittest discover -s tests
|
|
91
98
|
uv run src-auth-perms-sync --help
|
|
92
|
-
npx --yes markdownlint-cli2
|
|
99
|
+
npx --yes markdownlint-cli2@0.22.1
|
|
93
100
|
uv build --wheel --out-dir /tmp/src-auth-perms-sync-release-check --no-create-gitignore
|
|
94
101
|
rm -rf /tmp/src-auth-perms-sync-release-check
|
|
95
102
|
```
|
|
@@ -229,7 +236,7 @@ Strict pyright covers the package. Root modules are entrypoints only:
|
|
|
229
236
|
- `cli.py` — `main()`, arg parsing, owns the CLI description.
|
|
230
237
|
- `shared/` — cross-workflow helpers: Sourcegraph auth-provider/user list
|
|
231
238
|
helpers, shared GraphQL operations and TypedDicts, site-config validation,
|
|
232
|
-
SAML group parsing
|
|
239
|
+
and SAML group parsing.
|
|
233
240
|
|
|
234
241
|
Business workflows live in packages:
|
|
235
242
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: src-auth-perms-sync
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Set Sourcegraph permissions from authentication provider data
|
|
5
5
|
Project-URL: Homepage, https://github.com/sourcegraph/src-auth-perms-sync
|
|
6
6
|
Project-URL: Issues, https://github.com/sourcegraph/src-auth-perms-sync/issues
|
|
@@ -18,7 +18,7 @@ Classifier: Typing :: Typed
|
|
|
18
18
|
Requires-Python: >=3.11
|
|
19
19
|
Requires-Dist: json5>=0.14.0
|
|
20
20
|
Requires-Dist: pyyaml>=6.0.3
|
|
21
|
-
Requires-Dist: src-py-lib==0.1.
|
|
21
|
+
Requires-Dist: src-py-lib==0.1.5
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
|
|
24
24
|
# src-auth-perms-sync
|
|
@@ -31,6 +31,19 @@ setting user-to-repo permissions based on mapping rules, for example:
|
|
|
31
31
|
and their SAML assertion includes group 1,
|
|
32
32
|
are granted access to repos cloned via code host X
|
|
33
33
|
|
|
34
|
+
## Experimental - This is not a supported Sourcegraph product
|
|
35
|
+
|
|
36
|
+
This repo was created for Sourcegraph Implementation Engineering deployments,
|
|
37
|
+
and is not intended, designed, built, or supported for use in any other scenario.
|
|
38
|
+
Feel free to open issues or PRs, but responses are best effort.
|
|
39
|
+
|
|
40
|
+
## Semantic Versioning
|
|
41
|
+
|
|
42
|
+
- Release versions are `major.minor.patch`
|
|
43
|
+
- Because this project is still major version 0:
|
|
44
|
+
- Minor version updates are breaking changes
|
|
45
|
+
- Patch version updates are not breaking changes
|
|
46
|
+
|
|
34
47
|
## Principles
|
|
35
48
|
|
|
36
49
|
- Customers need to be able to trust this, and audit this, similar to code
|
|
@@ -8,6 +8,19 @@ setting user-to-repo permissions based on mapping rules, for example:
|
|
|
8
8
|
and their SAML assertion includes group 1,
|
|
9
9
|
are granted access to repos cloned via code host X
|
|
10
10
|
|
|
11
|
+
## Experimental - This is not a supported Sourcegraph product
|
|
12
|
+
|
|
13
|
+
This repo was created for Sourcegraph Implementation Engineering deployments,
|
|
14
|
+
and is not intended, designed, built, or supported for use in any other scenario.
|
|
15
|
+
Feel free to open issues or PRs, but responses are best effort.
|
|
16
|
+
|
|
17
|
+
## Semantic Versioning
|
|
18
|
+
|
|
19
|
+
- Release versions are `major.minor.patch`
|
|
20
|
+
- Because this project is still major version 0:
|
|
21
|
+
- Minor version updates are breaking changes
|
|
22
|
+
- Patch version updates are not breaking changes
|
|
23
|
+
|
|
11
24
|
## Principles
|
|
12
25
|
|
|
13
26
|
- Customers need to be able to trust this, and audit this, similar to code
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# TODO
|
|
2
2
|
|
|
3
|
+
## High priority: Bump src-py-lib after Node ID helper release
|
|
4
|
+
|
|
5
|
+
- After releasing `src-py-lib` with Sourcegraph Node ID helpers, update
|
|
6
|
+
`pyproject.toml` and `uv.lock` to depend on that new version.
|
|
7
|
+
|
|
3
8
|
## Medium priority: Lightweight incremental updates
|
|
4
9
|
|
|
5
10
|
- When a new user's account is created, or a new repo is synced from a code host,
|