Skip to content

Commit 7f99949

Browse files
authored
chore: Update to use the version tag directly since metadata service can handle it (#39)
1 parent dfdf33a commit 7f99949

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

.github/workflows/test_action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ jobs:
3737
git tag -f v0.0.0 HEAD
3838
git push -f origin v0.0.0
3939
40-
test-agent-flow-no-v-version:
40+
test-agent-flow-basic:
4141
needs: setup-test-tag
42-
name: Test Agent Repository Flow
42+
name: Test Agent Repository Flow (Basic)
4343
runs-on: ubuntu-latest
4444
steps:
4545
- name: Checkout action repository
@@ -84,7 +84,7 @@ jobs:
8484
newrelic-client-id: fake-client-id-for-testing
8585
newrelic-private-key: ZmFrZS1wcml2YXRlLWtleS1mb3ItdGVzdGluZwo=
8686
agent-type: 'myagent'
87-
version: '0.0.0'
87+
version: 'v0.0.0'
8888
cache: false
8989

9090
- name: Show mock server logs
@@ -101,9 +101,9 @@ jobs:
101101
rm mock-server.pid
102102
fi
103103
104-
test-agent-flow-v-version:
104+
test-agent-flow-with-oci:
105105
needs: setup-test-tag
106-
name: Test Agent Repository Flow with "v" prefixed version
106+
name: Test Agent Repository Flow (with OCI uploads)
107107
runs-on: ubuntu-latest
108108
services:
109109
registry:
@@ -356,7 +356,7 @@ jobs:
356356
cleanup-test-tag:
357357
name: Cleanup Test Tag
358358
runs-on: ubuntu-latest
359-
needs: [test-agent-flow-no-v-version, test-agent-flow-v-version, test-docs-flow]
359+
needs: [test-agent-flow-basic, test-agent-flow-with-oci, test-docs-flow]
360360
if: always()
361361
steps:
362362
- name: Checkout action repository

CLAUDE.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ go test -v -run TestLoadEnv_Success ./internal/config
9292
# Local development (requires GITHUB_WORKSPACE to be set)
9393
export GITHUB_WORKSPACE=/path/to/repo
9494
./agent-metadata-action
95-
96-
# Or use run_local.sh for testing
97-
./run_local.sh
9895
```
9996

10097
## Architecture
@@ -371,7 +368,7 @@ export GITHUB_WORKSPACE=/path/to/repo
371368
- `newrelic-client-id` (required): NewRelic client ID for authentication
372369
- `newrelic-private-key` (required): NewRelic private key content (base64-encoded)
373370
- `agent-type` (optional): Agent type (e.g., "NRDotNetAgent")
374-
- `version` (optional): Agent version in semver format (e.g., "1.2.3" or "v1.2.3")
371+
- `version` (optional): Agent version tag name (e.g., "v1.2.3"). Must match the exact git tag name for checkout.
375372
- `fetch-depth` (optional, default: 1): Number of commits to fetch (>1 may be needed for docs flow)
376373
- `cache` (optional, default: true): Enable Go build caching
377374
- `oci-registry` (optional): OCI registry URL for binary uploads (e.g., "ghcr.io/newrelic/agents"). Leave empty to skip binary upload.
@@ -381,11 +378,11 @@ export GITHUB_WORKSPACE=/path/to/repo
381378

382379
**Steps:**
383380

384-
1. **Normalize version tag**: Prepends "v" to version if not present for tag checkout
385-
- Output: `ref` variable with normalized version tag
381+
1. **Set version ref**: Sets the version tag for checkout
382+
- Output: `ref` variable with the exact version tag provided
386383

387384
2. **Checkout repository**: Uses `actions/checkout@v4`
388-
- For agent flow: Checks out the normalized version tag (e.g., "v1.2.3")
385+
- For agent flow: Checks out the exact version tag as provided (e.g., "v1.2.3")
389386
- For docs flow: Checks out the PR commit (when `ref` is empty)
390387
- Uses `fetch-depth` input for controlling commit history depth
391388
- Sets `GITHUB_WORKSPACE` environment variable automatically
@@ -426,7 +423,7 @@ export GITHUB_WORKSPACE=/path/to/repo
426423

427424
**Key behaviors:**
428425
- The action automatically handles repository checkout, so users don't need a separate `actions/checkout` step
429-
- Version normalization ensures consistent tag format (with "v" prefix)
426+
- Version tag must match the exact git tag name (no automatic normalization)
430427
- Authentication is handled automatically and securely (credentials masked in logs)
431428
- Both agent and docs flows are supported based on whether inputs are provided
432429
- OCI binary uploads are optional and only occur in agent flow when `oci-registry` is configured

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
newrelic-client-id: ${{ secrets.OAUTH_CLIENT_ID }}
4747
newrelic-private-key: ${{ secrets.OAUTH_CLIENT_SECRET }}
4848
agent-type: NRDotNetAgent # Required for agent release workflow: The type of agent (e.g., NRJavaAgent, NRNodeAgent)
49-
version: 1.0.0 # Required for agent release workflow: will be used to check out appropriate release tag
49+
version: v1.0.0 # Required for agent release workflow: must match exact git tag name for checkout
5050
cache: true # Optional: Enable Go build cache (default: true)
5151
oci-registry: docker.io/newrelic/agents # Optional: OCI registry URL for binary uploads
5252
oci-username: ${{ github.actor }} # Optional: OCI registry username

action.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ inputs:
1212
required: false
1313
default: ''
1414
version:
15-
description: 'Agent version in semver format (ex. 1.2.3 or v1.2.3). The action will prepend "v" if not present for tag checkout.'
15+
description: 'Agent version tag name (ex. v1.2.3). Must match the exact git tag name for checkout.'
1616
required: false
1717
default: ''
1818
fetch-depth:
@@ -46,16 +46,11 @@ inputs:
4646
runs:
4747
using: 'composite'
4848
steps:
49-
- name: Normalize version tag for checkout
49+
- name: Set version ref for checkout
5050
id: version
5151
shell: bash
5252
run: |
53-
VERSION="${{ inputs.version }}"
54-
if [[ -n "$VERSION" && ! "$VERSION" =~ ^v ]]; then
55-
echo "ref=v${VERSION}" >> $GITHUB_OUTPUT
56-
else
57-
echo "ref=${VERSION}" >> $GITHUB_OUTPUT
58-
fi
53+
echo "ref=${{ inputs.version }}" >> $GITHUB_OUTPUT
5954
6055
- name: Checkout repository
6156
uses: actions/checkout@v4

0 commit comments

Comments
 (0)