Skip to content

refactor: simplify AWS CodeArtifact publishing to use AWS secrets + PYPI_REPOSITORY_URL#886

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/extend-release-to-aws-codeartifact
Draft

refactor: simplify AWS CodeArtifact publishing to use AWS secrets + PYPI_REPOSITORY_URL#886
Copilot wants to merge 6 commits intomainfrom
copilot/extend-release-to-aws-codeartifact

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

Summary

Simplifies the AWS CodeArtifact publishing support by integrating it directly into the existing PyPI publishing job, rather than as a separate workflow job. Users configure just three items: two GitHub Secrets (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) and one GitHub Variable (PYPI_REPOSITORY_URL pointing to the CodeArtifact endpoint). The workflow auto-detects CodeArtifact URLs and handles token exchange transparently.

Changes

GitHub Actions (.github/workflows/rhiza_release.yml):

  • Removed the separate codeartifact job — CodeArtifact is now handled inline in the pypi job
  • Added "Get AWS CodeArtifact token" step that auto-detects CodeArtifact URLs in PYPI_REPOSITORY_URL, parses domain/region, and fetches a temporary auth token using AWS secrets
  • Updated the publish step to use the CodeArtifact token (with aws username) when available, falling back to PYPI_TOKEN or OIDC
  • Updated Private :: Do Not Upload check: now only blocks publishing to default PyPI — custom feeds (including CodeArtifact) still publish
  • Removed codeartifact from finalise-release dependencies and link generation

GitLab CI (.gitlab/workflows/rhiza_release.yml):

  • Removed the separate release:codeartifact job — same inline integration into release:pypi
  • Added CodeArtifact auto-detection and token handling with error handling
  • Updated release:finalize to remove codeartifact dependency

Documentation:

  • .rhiza/docs/RELEASING.md: simplified CodeArtifact setup to 3 configuration items with step-by-step instructions
  • docs/ARCHITECTURE.md: updated release pipeline diagram (removed separate CodeArtifact box)
  • docs/PRESENTATION.md, docs/CHANGELOG_GUIDE.md, .gitlab/TESTING.md, .gitlab/README.md: updated to reflect simplified approach

User configuration (all that's needed for CodeArtifact):

Type Name Description
Secret AWS_ACCESS_KEY_ID IAM user access key
Secret AWS_SECRET_ACCESS_KEY IAM user secret key
Variable PYPI_REPOSITORY_URL CodeArtifact endpoint URL

No OIDC setup, no domain/repository variables, no separate job. The workflow auto-detects CodeArtifact URLs and handles everything.

Testing

  • make test passes locally
  • make fmt has been run (actionlint, shellcheck, markdownlint all pass)
  • New tests added (or explain why not needed)
    • Workflow YAML validated via actionlint and check-jsonschema pre-commit hooks. Both YAML files parsed and structurally verified. No unit-testable application code was changed.

Checklist

  • Commit messages follow the Conventional Commits format
  • Documentation updated if behaviour changed
  • make deptry passes (no unused or missing dependencies)
Original prompt

This section details on the original issue you should resolve

<issue_title>Extension to release to AWS CodeArtifact</issue_title>
<issue_description>### Problem / motivation

Not clear if this is already supported. If not, let's extend ...

possibly required in rhiza_release.yml?

- name: Configure AWS credentials
  if: ${{ steps.check_dist.outputs.should_publish == 'true' }}
  uses: aws-actions/configure-aws-credentials@v4
  with:
    role-to-assume: ${{ vars.AWS_ROLE_ARN }}
    aws-region: eu-west-2

- name: Get CodeArtifact token
  if: ${{ steps.check_dist.outputs.should_publish == 'true' }}
  id: codeartifact
  run: |
    TOKEN=$(aws codeartifact get-authorization-token \
      --domain ringfinity --region eu-west-2 \
      --query authorizationToken --output text)
    echo "::add-mask::$TOKEN"
    echo "token=$TOKEN" >> "$GITHUB_OUTPUT"

Proposed solution

Let's get claude to see what (if anything) is required to get this running.

Alternatives considered

No response

Additional context

No response</issue_description>

<agent_instructions>Let's figure this out in the most general terms. Once solved, provide crystal clear instructions for any additional config required by the user</agent_instructions>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Add a new CodeArtifact job to both GitHub Actions and GitLab CI release
workflows. The job is conditional on AWS_CODEARTIFACT_DOMAIN being set
and uses OIDC-based role assumption (GitHub) or CI/CD variables (GitLab)
for credential-free authentication.

- Add `codeartifact` job to `.github/workflows/rhiza_release.yml`
- Add `release:codeartifact` job to `.gitlab/workflows/rhiza_release.yml`
- Update finalise-release jobs to include CodeArtifact links in release notes
- Add comprehensive setup instructions to RELEASING.md
- Update architecture diagrams and documentation

Co-authored-by: markrichardson <5681211+markrichardson@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Jebel-Quant/rhiza/sessions/ecb241b0-b8bf-4bb7-a48b-7467c69e6fec
Copilot AI changed the title [WIP] Extend release process to support AWS CodeArtifact feat: add AWS CodeArtifact publishing to release workflows Mar 21, 2026
Copilot AI requested a review from markrichardson March 21, 2026 22:03
@markrichardson
Copy link
Contributor

@tschm @HarryCampion ... reasonable?

@HarryCampion
Copy link
Collaborator

@tschm @HarryCampion ... reasonable?

If we're going down the route of very custom deployments like this we should split these into actions. Release will get very big otherwise.

I have not used AWS CodeArtifact before. What's the use case?

@markrichardson
Copy link
Contributor

markrichardson commented Mar 21, 2026

We would want to eventually have a number of standard options catered for out of the box: PyPi (done already as the standard), but also Azure, AWS, Nexus. So some way of the rhiza user abstractly specifying what they want in this regard upfront would be good. Thinking about the way bundles work, something simliar would be useful here. (User states in a yaml somehow ... "I am publishing artifacts to AWS, not PyPi, here are all the details you need to make it happen")

@HarryCampion
Copy link
Collaborator

We would want to eventually have a number of standard options catered for out of the box: PyPi (done already as the standard), but also Azure, AWS, Nexus. So some way of the rhiza user abstractly specifying what they want in this regard upfront would be good. Thinking about the way bundles work, something simliar would be useful here. (User states in a yaml somehow ... "I am publishing artifacts to AWS, not PyPi, here are all the details you need to make it happen")

Think most get covered by the action we use if twine can upload, otherwise makes sense. They need to be actions that can be included and excluded in the template, other rhiza release is going to bundle too much into one workflow.

@markrichardson
Copy link
Contributor

it looks like twine can be used. but claude thinks it needs changes to the the rhiza-release.yml also

@tschm
Copy link
Member

tschm commented Mar 22, 2026

@HarryCampion the "make release" flow is genuinely excellent it just works, which is very appreciated.

It also looks like you already have the right infrastructure in place to test all of this properly.

Have you come across JFrog? They’ve built quite a comprehensive ecosystem around artifact management and CI/CD.

That said, Astral seems to be working on something that could potentially leapfrog a lot of the existing solutions.

@HarryCampion
Copy link
Collaborator

@claude[agent] I think it would be great to support additional endpoints for artifact feeds. Could you please refactor the release pipeline to allow different release actions to be injected depending on the 'artifact provider/storage mechanism'. This will eventually mean a user can define at the .rhiza/template.yml level what artifact feed they are using and not have to worry about configuring the release mechanism and also the rhiza release workflow is then not polluted.

@Claude
Copy link

Claude AI commented Mar 23, 2026

@claude[agent] I think it would be great to support additional endpoints for artifact feeds. Could you please refactor the release pipeline to allow different release actions to be injected depending ...

I understand the goal of making release targets configurable and preventing workflow bloat. However, I need to clarify the scope and approach before proceeding with this refactor.

Current Architecture Analysis:
The release workflows are already opt-in via repository variables:

  • PyPI: Skips if Private :: Do Not Upload classifier present
  • CodeArtifact: Skips if AWS_CODEARTIFACT_DOMAIN not set
  • Devcontainer: Skips if PUBLISH_DEVCONTAINER != "true"

Concerns with Proposed Approach:

  1. GitHub Actions Limitations: Unlike bundles (which are file-based templates), GitHub Actions can't dynamically compose workflow jobs at runtime. Workflow files must be complete and valid YAML before execution starts.

  2. Template System Scope: The .rhiza/template.yml and bundle system controls which files are synced to downstream projects, but it doesn't support conditional job injection within a single workflow file.

  3. Complexity vs. Value: Creating an abstraction layer for "injectable release actions" would require:

    • A new configuration schema in .rhiza/template.yml
    • Template preprocessing/generation logic
    • Maintaining multiple workflow variants
    • This adds significant complexity for what's currently 3 opt-in jobs

Proposed Alternative:
Instead of refactoring the monolithic workflow, we could:

  1. Split each publishing target into a reusable workflow (.github/workflows/publish-*.yml)
  2. Keep the main rhiza_release.yml as a coordinator that calls these reusable workflows
  3. Users can then override/customize individual publish workflows or disable them via variables

Would you like me to explore this reusable workflow approach, or would you prefer a different strategy? I want to ensure we solve the right problem before making significant architectural changes.

@Claude Claude AI changed the title feat: add AWS CodeArtifact publishing to release workflows Addressing PR comments Mar 23, 2026
@markrichardson
Copy link
Contributor

@copilot

please ensure the user can configure AWS CodeArtifact within Rhiza via provision of the following:

Set two GitHub Secrets: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
Set one GitHub Variable: PYPI_REPOSITORY_URL (for publishing)

Copilot AI and others added 2 commits March 23, 2026 19:50
Remove the separate codeartifact job from both GitHub Actions and GitLab CI
workflows. Instead, integrate CodeArtifact support directly into the existing
pypi job — auto-detect CodeArtifact URLs and fetch a temporary auth token
using AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY secrets.

Users configure just 3 things:
- AWS_ACCESS_KEY_ID (secret)
- AWS_SECRET_ACCESS_KEY (secret)
- PYPI_REPOSITORY_URL (variable, set to CodeArtifact endpoint)

Co-authored-by: markrichardson <5681211+markrichardson@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Jebel-Quant/rhiza/sessions/d31294fb-ccb9-44fc-8f54-4720cee99ca3
…fe pattern matching

Co-authored-by: markrichardson <5681211+markrichardson@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Jebel-Quant/rhiza/sessions/d31294fb-ccb9-44fc-8f54-4720cee99ca3
Copy link
Contributor Author

Copilot AI commented Mar 23, 2026

@copilot

please ensure the user can configure AWS CodeArtifact within Rhiza via provision of the following:
...

Done in f501825. Removed the separate codeartifact job from both GitHub Actions and GitLab CI workflows. CodeArtifact support is now integrated into the existing pypi job — it auto-detects CodeArtifact URLs in PYPI_REPOSITORY_URL and fetches a temporary auth token using the AWS secrets.

Configuration is just 3 items:

  • Secret AWS_ACCESS_KEY_ID — IAM user access key
  • Secret AWS_SECRET_ACCESS_KEY — IAM user secret key
  • Variable PYPI_REPOSITORY_URL — CodeArtifact endpoint (get it via aws codeartifact get-repository-endpoint)

The Private :: Do Not Upload classifier now only blocks publishing to default PyPI — when PYPI_REPOSITORY_URL is set (e.g. CodeArtifact), private packages still publish. Full setup instructions in .rhiza/docs/RELEASING.md.

Copilot AI changed the title Addressing PR comments refactor: simplify AWS CodeArtifact publishing to use AWS secrets + PYPI_REPOSITORY_URL Mar 23, 2026
@HarryCampion
Copy link
Collaborator

@markrichardson can you point dummyrepo at this to test publishing mechanism still works. E..g PRIVATE is not publishing?

@markrichardson
Copy link
Contributor

I don't think we ever set up dummyrepo to publish to pypi even so not sure what we could validate (or invalidate) doing this

@HarryCampion
Copy link
Collaborator

I don't think we ever set up dummyrepo to publish to pypi even so not sure what we could validate (or invalidate) doing this

It would confirm the path it takes for deployment. It shouldn't publish.

@markrichardson
Copy link
Contributor

see markrichardson/dummyrepo#86

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.

Extension to release to AWS CodeArtifact

5 participants