Skip to content

feat: add circleci as trusted publisher#19349

Open
meeech wants to merge 44 commits intopypi:mainfrom
meeech:add-cci-trusted-publisher-take-2
Open

feat: add circleci as trusted publisher#19349
meeech wants to merge 44 commits intopypi:mainfrom
meeech:add-cci-trusted-publisher-take-2

Conversation

@meeech
Copy link
Copy Markdown
Contributor

@meeech meeech commented Jan 20, 2026

#13888

Related PRs:

pypi/pypi-attestations#166 Add CircleCI to pypi-attestations
meeech#1 Stacked pr off this one - integrates attestations. Question: would it be better to just merge this into have the one pr? I was trying to be mindful of making things easier to review.

I have tried to keep commits bite sized. I am open to split this up into multiple prs if that preferred (though not sure where the 'fault lines' would be for this since its all a bit related - forms, model, etc? let me know

MUST

  • we must reject any publish where the ssh-rerun claim is true. like we don't even allow the exchange for an api token to do the publish ✅

while i worked with a LLM to generate this PR, i (the human) have reviewed all this code. (amp for the curious)
tbf it did a good job doing all the boilerplate.

Basically I try to adhere to https://github.com/ghostty-org/ghostty/blob/main/AI_POLICY.md

{% macro circleci_form(request, pending_circleci_publisher_form) %}
<p>
{% trans href="https://circleci.com/docs/openid-connect-tokens/" %}
Read more about CircleCI's OpenID Connect support <a href="{{ href }}">here</a>.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: prep page about this form for CCI guides, lets add a link to that as well. though its a chicken egg issue i suspect. but if we can get this deployed to staging warehouse, can then build a guide and do a followup pr to add the link before hitting prod

@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from a2568a4 to 44d7223 Compare January 22, 2026 04:49
@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Jan 27, 2026

milestone:

the 0.0.1.dev87 was published from
workflow https://app.circleci.com/workflow/0af1fd55-41dd-4bf8-9706-c632647f83f2

to my local pypi

image

@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from 6ec2327 to 9fe9b93 Compare January 27, 2026 02:50
@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Jan 27, 2026

image

@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from 5b980b7 to 459fa6e Compare February 5, 2026 04:05
@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from 459fa6e to 669a67a Compare February 7, 2026 15:32
@meeech meeech marked this pull request as ready for review February 7, 2026 16:32
@meeech meeech requested a review from a team as a code owner February 7, 2026 16:32
@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from 1e6acfb to bdae7b2 Compare February 18, 2026 17:11
@meeech meeech changed the title feat: add circleci as trusted publisher (take2) [wip] feat: add circleci as trusted publisher Feb 18, 2026
@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Feb 18, 2026

So I think this is ready for review. I left some open questions about process - eg: would it be preferred for me to add in the attestation work into this pr? or better to leave stacked.

Copy link
Copy Markdown
Member

@di di left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, looks like translations need updated and also the "revises" field for the database migration as we've had additional migrations since you generated it.

@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from bdae7b2 to 92ccbca Compare February 23, 2026 00:31
@meeech meeech marked this pull request as draft February 25, 2026 02:16
@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Feb 25, 2026

converted to draft while I add the api lookup for org name and project name, as well as fix up one or two other things

meeech and others added 14 commits March 11, 2026 23:42
Add tests for parity with GitHub/GitLab form tests:
- ProjectNameUnavailable*Error variants (Invalid, Existing, Stdlib, Prohibited, Similar)
- Optional field consistency tests for vcs_ref, vcs_origin, context_id
- Parametrized invalid field tests for required UUID fields
- Empty string vs None consistency for optional fields

Signed-off-by: meeech <4623+meeech@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c003a-2977-70f9-ad05-cce7fb3236a0
Co-authored-by: Amp <amp@ampcode.com>
Fill in actual values for optional CircleCI fields (context_id, vcs_ref,
vcs_origin) to match the pattern used by GitHub/GitLab tests which
populate their optional fields with real values.

Signed-off-by: meeech <4623+meeech@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c003a-2977-70f9-ad05-cce7fb3236a0
Co-authored-by: Amp <amp@ampcode.com>
Add pipeline_definition_id, context_id, vcs_ref, and vcs_origin to the
CircleCI trusted publisher display in manage_base.html. Also update test
factories to include vcs_ref and vcs_origin fields.

Amp-Thread-ID: https://ampcode.com/threads/T-019c2939-421d-757c-9608-2f7b1758b9c0
Co-authored-by: Amp <amp@ampcode.com>
ran make resetdb and make initdb, seems fine
align handling optional fields to how other publishers handle it. was doing or "" in a few places - but we can see that github normalizes the env on the form itself, and then use the normalized field where necessary
* update schema for new metadata we fetch from cci api - org name, proj name
* remove nullable=True for the optionals on the publisher - we normalize these to empty strings since they are part of the unique constraints - they should never be null
- Refactor publisher_base_url and publisher_url methods to return constructed URLs instead of None.
- Update tests to reflect the new URL structure.
- Modify template to link project name and ID to their respective CircleCI URLs.
@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from f54ede0 to de7dcf9 Compare March 12, 2026 03:48
@meeech meeech force-pushed the add-cci-trusted-publisher-take-2 branch from 303a370 to 749a665 Compare March 18, 2026 13:53
@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Mar 18, 2026

@di I think this is ready for another review when y'all are.

@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Mar 19, 2026

@di I think I've addressed all the feedback and its ready again

@di di requested a review from miketheman March 19, 2026 13:41
@di
Copy link
Copy Markdown
Member

di commented Mar 19, 2026

Hey @meeech, thanks for your work here so far. I'm just a volunteer on the project and as a result have had less time to spend working on it lately. I've asked @miketheman who is PSF staff to review instead.

@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Mar 19, 2026

@di thank you for your work on this :D Sorry about that - i wasn't sure about who to ping - just figured since you were the latest to give feedback I did. trying to be mindful of not making demands on peeps/giving time for reviews since i know a lot of people are busy. def appreciate the feeedback so far, and thanks for pinging @miketheman

@meeech
Copy link
Copy Markdown
Contributor Author

meeech commented Mar 30, 2026

@miketheman anything i can do to move this forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants