Skip to content

Commit 190d787

Browse files
Merge pull request #43 from AllenCell/feature/codeartifact-migration
CodeArtifact migration
2 parents 220228c + ebce161 commit 190d787

2 files changed

Lines changed: 32 additions & 8 deletions

File tree

.github/workflows/test-and-check.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,38 @@ jobs:
6666
needs: [test]
6767
runs-on: [self-hosted, build]
6868

69+
permissions:
70+
id-token: write # Needed for OIDC
71+
contents: read # Needed to check out code
72+
73+
env:
74+
AWS_REGION: ${{ vars.AWS_DEFAULT_REGION }}
75+
AWS_ACCOUNT_ID: ${{ vars.AWS_SOFTWARE_ACCOUNT_ID }}
76+
ENVIRONMENT: production
77+
6978
steps:
7079
- uses: actions/checkout@v4
7180
- name: Set up Python
7281
uses: actions/setup-python@v4
7382
with:
7483
python-version: "3.9"
84+
85+
86+
- name: Configure AWS credentials via OIDC
87+
uses: aws-actions/configure-aws-credentials@v2
88+
with:
89+
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/github_camera_alignment_core
90+
aws-region: ${{ env.AWS_REGION }}
91+
92+
- name: Get CodeArtifact auth token
93+
id: codeartifact
94+
run: |
95+
export CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
96+
--domain ${{ env.ENVIRONMENT}} \
97+
--domain-owner ${{ env.AWS_ACCOUNT_ID }} \
98+
--query authorizationToken --output text)
99+
echo "CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" >> $GITHUB_ENV
100+
75101
- name: Install Dependencies
76102
run: |
77103
python -m pip install --upgrade pip
@@ -81,7 +107,7 @@ jobs:
81107
make build
82108
- name: Publish to internal package index
83109
env:
84-
TWINE_USERNAME: ${{ secrets.ARTIFACTORY_USER }}
85-
TWINE_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
110+
TWINE_USERNAME: aws
111+
TWINE_PASSWORD: ${{ env.CODEARTIFACT_AUTH_TOKEN }}
86112
TWINE_NON_INTERACTIVE: true
87-
run: twine upload --verbose --repository-url='https://artifactory.corp.alleninstitute.org/artifactory/api/pypi/pypi-release-local' dist/*
113+
run: twine upload --verbose --repository-url='https://${{ env.ENVIRONMENT}}-${{ env.AWS_ACCOUNT_ID }}.d.codeartifact.us-west-2.amazonaws.com/pypi/pypi-release-local/' dist/*

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ Core algorithms for aligning two-camera microscopy imagery
1010

1111
`pip install camera_alignment_core==1.0.6`<br>
1212

13-
This library is published to a private PyPI server ("Artifactory") accessible within the Allen Institute network or over VPN. This has downstream effects for how this library is installed into other Python packages.
14-
15-
Having trouble installing? Start here: http://confluence.corp.alleninstitute.org/display/SF/Using+Artifactory#UsingArtifactory-Python.
13+
This library is published to a private PyPI server on AWS CodeArtifact accessible within the Allen Institute network or over VPN. This has downstream effects for how this library is installed into other Python packages.
1614

1715

1816
## Documentation
@@ -134,9 +132,9 @@ see `Makefile` for others or to inspect the underlying scripts run as part of th
134132
Releasing fixes requires more than merging to main.
135133
1. everything in step 2 above: (eg, make lint type-check fmt import-sort )
136134
2. make doc: (to confirm the docs build)
137-
3. make publish: to publish to artifactory. Requires a ~/.pypirc file with an entry like:
135+
3. make publish: to publish to CodeArtifact. Requires a ~/.pypirc file with an entry like:
138136
[release-local]
139-
repository = https://artifactory.corp.alleninstitute.org/artifactory/api/pypi/pypi-release-local
137+
repository = https://production-239877123246.d.codeartifact.us-west-2.amazonaws.com/pypi/pypi-release-local/
140138
4. Update the example-venv lockfile to use the new release.
141139
1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
142140
2. `cd example-venv && uv lock && uv sync`

0 commit comments

Comments
 (0)