Skip to content

Commit 1cf411f

Browse files
committed
fix: improve publish auth and add debugging
1 parent 7e7a948 commit 1cf411f

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

.github/workflows/publish.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Security notes:
2-
# - GitHub-owned actions (actions/checkout) use tag pins
3-
# - Third-party actions (jfrog/setup-jfrog-cli) are pinned to full commit SHAs
4-
# - Rust toolchain comes from the runner's pre-installed rustup
2+
# - GitHub-owned actions use tag pins, third-party actions use SHA pins
3+
# - Only two external actions: actions/checkout (GitHub-owned) and
4+
# jfrog/setup-jfrog-cli (allowlisted, handles OIDC auth)
5+
# - Rust toolchain uses the runner's pre-installed rustup
56
# - The publish environment requires the anthropic-1.49.0 branch
67
name: Publish to Artifactory
78

@@ -27,28 +28,48 @@ jobs:
2728
rustup show
2829
2930
- name: Setup JFrog CLI
31+
id: setup-jfrog
3032
uses: jfrog/setup-jfrog-cli@ff5cb544114ffc152db9cea1cd3d5978d5074946 # v4.5.11
3133
env:
3234
JF_URL: https://artifactory.infra.ant.dev
3335
with:
3436
oidc-provider-name: github
3537
oidc-audience: jfrog-github
3638

37-
- name: Configure Cargo
39+
- name: Configure Cargo Registry
3840
run: |
39-
ARTIFACTORY_TOKEN=$(jf config show | grep "Access Token" | awk '{print $3}')
4041
mkdir -p ~/.cargo
41-
cat >> ~/.cargo/config.toml << EOF
42+
cat >> ~/.cargo/config.toml << 'EOF'
4243
[registries.crates-internal]
4344
index = "sparse+https://artifactory.infra.ant.dev/artifactory/api/cargo/crates-internal/index/"
4445
credential-provider = ["cargo:token"]
4546
EOF
46-
# TODO: Consider adding crates-io source replacement through Artifactory proxy
47-
# once OIDC token read access to the crates-io proxy is confirmed.
48-
# For now, cargo resolves dependencies from public crates.io directly.
49-
cargo login --registry crates-internal <<< "Bearer ${ARTIFACTORY_TOKEN}"
47+
48+
- name: Debug - Verify Access
49+
env:
50+
CARGO_REGISTRIES_CRATES_INTERNAL_TOKEN: "Bearer ${{ steps.setup-jfrog.outputs.oidc-token }}"
51+
run: |
52+
echo "=== Token check ==="
53+
echo "Token length: ${#CARGO_REGISTRIES_CRATES_INTERNAL_TOKEN}"
54+
echo "Token starts with Bearer: $(echo "$CARGO_REGISTRIES_CRATES_INTERNAL_TOKEN" | grep -c '^Bearer ')"
55+
56+
echo ""
57+
echo "=== JFrog CLI ping ==="
58+
jf rt ping
59+
60+
echo ""
61+
echo "=== Cargo config ==="
62+
cat ~/.cargo/config.toml
63+
64+
echo ""
65+
echo "=== curl test (with auth) ==="
66+
curl -sI -H "Authorization: ${CARGO_REGISTRIES_CRATES_INTERNAL_TOKEN}" \
67+
"https://artifactory.infra.ant.dev/artifactory/api/cargo/crates-internal/index/to/ki/tokio" \
68+
2>&1 | grep -E "HTTP|WWW-Auth" || true
5069
5170
- name: Publish tokio to Artifactory
71+
env:
72+
CARGO_REGISTRIES_CRATES_INTERNAL_TOKEN: "Bearer ${{ steps.setup-jfrog.outputs.oidc-token }}"
5273
run: |
5374
cd tokio
5475
cargo publish --registry crates-internal --allow-dirty

0 commit comments

Comments
 (0)