Skip to content

feat: save context between calls - #1923

Merged
TerryHowe merged 3 commits into
oras-project:mainfrom
TerryHowe:feature-save-context-between-calls
Jul 23, 2026
Merged

TerryHowe merged 3 commits into
oras-project:mainfrom
TerryHowe:feature-save-context-between-calls

Conversation

@TerryHowe

@TerryHowe TerryHowe commented Dec 6, 2025 •

Copy link
Copy Markdown
Member

What this PR does / why we need it:

This change saves authentication cache between calls so ORAS go scripting will auth once for most usages.

I created a test application to functional test this and it only authenticates the once.

With debug on, the second in-process call does not try to authenticate — no anonymous request, no 401 challenge. It attaches credentials proactively from the shared cache and goes straight to 200.

┌──────────────────────────────────┬───────────┬───────────┬─────────────┬───────────────┐
│              Build               │  CALL 1   │  CALL 2   │ Client 401s │ Registry 401s │
├──────────────────────────────────┼───────────┼───────────┼─────────────┼───────────────┤
│ Parent 7383f87 (no shared cache) │ 401 → 200 │ 401 → 200 │ 2           │ 2             │
├──────────────────────────────────┼───────────┼───────────┼─────────────┼───────────────┤
│ PR #1923 46fffb6 (shared cache)  │ 401 → 200 │ 200       │ 1           │ 1             │
└──────────────────────────────────┴───────────┴───────────┴─────────────┴───────────────┘

Client trace for the PR build, verbatim — CALL 2 has a single request and it's already authenticated:
CALL 1: GET .../manifests/v1  -> "401 Unauthorized"
        GET .../manifests/v1  -> "200 OK"
CALL 2: GET .../manifests/v1  -> "200 OK"
Parent build, same program — CALL 2 re-challenges from scratch:
CALL 2: GET .../manifests/v1  -> "401 Unauthorized"
        GET .../manifests/v1  -> "200 OK"

@codecov

codecov Bot commented Dec 6, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.19%. Comparing base (f6efe48) to head (d63287c).
⚠️ Report is 93 commits behind head on main.

Files with missing lines Patch % Lines
cmd/oras/internal/option/remote.go 80.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1923      +/-   ##
==========================================
+ Coverage   87.14%   87.19%   +0.04%     
==========================================
  Files         143      143              
  Lines        5540     5559      +19     
==========================================
+ Hits         4828     4847      +19     
  Misses        425      425              
  Partials      287      287              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TerryHowe TerryHowe changed the title feature: save context between calls feat: save context between calls Dec 26, 2025
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions Bot added stale Inactive issues or pull requests and removed stale Inactive issues or pull requests labels Mar 11, 2026
@TerryHowe TerryHowe added this to the v1.4.0 milestone Mar 18, 2026
Comment thread cmd/oras/internal/option/remote.go Resolved
@TerryHowe
TerryHowe merged commit e5f2178 into oras-project:main Jul 23, 2026
9 checks passed
@TerryHowe
TerryHowe deleted the feature-save-context-between-calls branch July 23, 2026 11:21
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