Skip to content

Commit e9a68d3

Browse files
feat(e2e): re-enable auto publish + install so ADO auto-updates
Restore the automated Marketplace publish in Job 1 (publish + share + install), so jobs 2 & 3 always exercise the PR's own code without a manual UI upload. The step was previously removed because it failed with "version must increase" on re-runs (same run_number => same version). Fix the version scheme to 0.<run_number>.<run_attempt>, which is strictly increasing across both new runs and re-runs, and is globally monotonic for the shared extension id. Gated on ADO_E2E_MARKETPLACE_PAT: unset => no-op, manual artifact upload still works. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 570250f commit e9a68d3

1 file changed

Lines changed: 66 additions & 5 deletions

File tree

.github/workflows/e2e-plugin-tests.yml

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,17 @@ jobs:
157157
- name: Package .vsix
158158
id: build_vsix
159159
env:
160-
# Traceable version so we can correlate the installed extension
161-
# back to this exact PR run.
162-
VSIX_VERSION: "0.${{ github.event.pull_request.number || 0 }}.${{ github.run_number }}"
160+
# Version must be strictly increasing for a single (publisher,
161+
# extension-id) — Marketplace rejects re-publishing an equal/lower
162+
# version, and ADO only auto-updates to a higher one. Since this
163+
# extension id is shared across every E2E run/PR, a PR-number-based
164+
# version would go backwards when an older PR runs after a newer one.
165+
# github.run_number is globally monotonic per workflow, and
166+
# github.run_attempt increments on "Re-run", so
167+
# 0.<run_number>.<run_attempt> is always increasing — no collisions
168+
# on re-runs (the exact bug that got auto-publish removed before).
169+
# The PR number is still surfaced in the artifact name + job summary.
170+
VSIX_VERSION: "0.${{ github.run_number }}.${{ github.run_attempt }}"
163171
# Bake the real destination publisher into the .vsix at build time.
164172
# Marketplace rejects uploads if the manifest publisher and the
165173
# destination publisher don't match exactly, so we cannot use a
@@ -212,6 +220,59 @@ jobs:
212220
retention-days: 14
213221
if-no-files-found: error
214222

223+
- name: Publish to Marketplace, share and install (auto-update the dev org)
224+
# Fully automates what used to be the manual UI step: publish the
225+
# freshly built .vsix to the private publisher, share it with the dev
226+
# org, and ensure it is installed there. Once installed, ADO
227+
# auto-updates the org to each new version on subsequent runs, so
228+
# jobs 2 & 3 exercise THIS PR's code.
229+
#
230+
# Gated on ADO_E2E_MARKETPLACE_PAT: if the secret is absent the step
231+
# is a no-op and the manual artifact-upload flow (below) still works.
232+
# The version scheme (0.<run_number>.<run_attempt>) guarantees a
233+
# strictly increasing version, so re-runs never hit the old
234+
# "version must increase" failure.
235+
env:
236+
MARKETPLACE_PAT: ${{ secrets.ADO_E2E_MARKETPLACE_PAT }}
237+
ADO_ORG: ${{ secrets.ADO_E2E_ORG }}
238+
PUBLISHER: "${{ secrets.ADO_E2E_PUBLISHER_ORG || secrets.ADO_E2E_ORG }}-private"
239+
EXTENSION_ID: ${{ steps.build_vsix.outputs.extension_id }}
240+
VSIX_VERSION: ${{ steps.build_vsix.outputs.vsix_version }}
241+
run: |
242+
set -euo pipefail
243+
if [ -z "${MARKETPLACE_PAT:-}" ]; then
244+
echo "ADO_E2E_MARKETPLACE_PAT not set — skipping auto-publish."
245+
echo "The .vsix is available as a workflow artifact for manual upload."
246+
exit 0
247+
fi
248+
249+
vsix_path="$(ls -1 ./*.vsix | head -1)"
250+
echo "Publishing $vsix_path (version $VSIX_VERSION) to publisher '$PUBLISHER' and sharing with org '$ADO_ORG'..."
251+
npx tfx extension publish \
252+
--vsix "$vsix_path" \
253+
--token "$MARKETPLACE_PAT" \
254+
--share-with "$ADO_ORG" \
255+
--no-wait-validation
256+
echo "Published and shared."
257+
258+
# Ensure the extension is installed in the org so ADO auto-updates to
259+
# each new version. Idempotent: on subsequent runs it's already
260+
# installed, so a non-zero exit here is non-fatal.
261+
echo "Ensuring extension '$EXTENSION_ID' is installed in '$ADO_ORG'..."
262+
if npx tfx extension install \
263+
--publisher "$PUBLISHER" \
264+
--extension-id "$EXTENSION_ID" \
265+
--service-url "https://${ADO_ORG}.visualstudio.com" \
266+
--token "$MARKETPLACE_PAT"; then
267+
echo "Install/enable confirmed."
268+
else
269+
echo "Install returned non-zero (likely already installed) — continuing."
270+
fi
271+
272+
echo "Waiting 90s for Marketplace async validation to settle before jobs 2 & 3 run their version check..."
273+
sleep 90
274+
echo "Done — ADO will auto-update to version $VSIX_VERSION."
275+
215276
- name: Write install instructions to job summary
216277
env:
217278
VSIX_VERSION: ${{ steps.build_vsix.outputs.vsix_version }}
@@ -220,11 +281,11 @@ jobs:
220281
ADO_ORG: ${{ secrets.ADO_E2E_ORG }}
221282
run: |
222283
{
223-
echo "## Manual install step (≈3 min, only when testing PR code)"
284+
echo "## Install (auto by default — manual steps are a fallback)"
224285
echo ""
225286
echo "**This PR built:** \`$VSIX_NAME\` (version \`$VSIX_VERSION\`, extension id \`$EXTENSION_ID\`)"
226287
echo ""
227-
echo "If you want the ADO test pipelines (jobs 2 & 3) to actually exercise this PR's code, do the following. If you skip this step the pipelines still run, but against whatever .vsix was installed previously."
288+
echo "When the \`ADO_E2E_MARKETPLACE_PAT\` secret is set, the *Publish to Marketplace* step already published, shared and installed this build, and ADO auto-updates the dev org — so jobs 2 & 3 test this PR's code automatically. The steps below are only needed if that secret is unset or the auto-publish step was skipped/failed."
228289
echo ""
229290
echo "1. **Download the .vsix** from the *Artifacts* section at the bottom of this run page (artifact: \`jfrog-ext-vsix-${{ github.run_number }}\`). It downloads as a .zip wrapper — unzip it to get the actual .vsix."
230291
echo "2. **Upload to your publisher** at https://marketplace.visualstudio.com/manage/publishers/${ADO_ORG}-private"

0 commit comments

Comments
 (0)