From bb0e1e53b81581d5c05a7c0e55d44e3bbdb01001 Mon Sep 17 00:00:00 2001 From: mrickard Date: Wed, 16 Oct 2024 14:40:37 -0400 Subject: [PATCH 1/2] ci: Added delay to site extension publishing to wait for NPM Signed-off-by: mrickard --- .github/workflows/azure-site-extension.yml | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/azure-site-extension.yml b/.github/workflows/azure-site-extension.yml index dd930cd7eb..87b5adceb1 100644 --- a/.github/workflows/azure-site-extension.yml +++ b/.github/workflows/azure-site-extension.yml @@ -36,10 +36,39 @@ jobs: node-version: ${{ matrix.node-version }} architecture: ${{ matrix.arch }} - - name: Find agent version + - name: Get local agent version run: | + $env:local_agent_version = node -p "require('./package.json').version" + echo "AGENT_VERSION=$env:local_agent_version" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Find agent version at npm + run: | + $env:npm_agent_version = npm view newrelic version + echo "NPM_AGENT_VERSION=$env:npm_agent_version" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Check NPM availability + if: ${{ env.NPM_AGENT_VERSION != env.AGENT_VERSION }} + run: | + $count = 0 + while($count -lt 10) { + Start-Sleep -s 120 + $npmversion = npm view newrelic version + echo "Checking npm ($count): $npmversion" + $test = [Version]$npmversion -match [Version]${{ env.AGENT_VERSION }} + if ([Version]$npmversion -match [Version]${{ env.AGENT_VERSION }}) { + break; + } + $count++ + } $env:npm_agent_version = npm view newrelic version - echo "AGENT_VERSION=$env:npm_agent_version" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "Done with delayed check. Published version: $env:npm_agent_version Local version: ${{env.AGENT_VERSION}}" + echo "NPM_AGENT_VERSION=$env:npm_agent_version" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Has the new agent been published? + if: ${{ env.NPM_AGENT_VERSION != env.AGENT_VERSION }} + run: | + echo "Published agent version (${{env.NPM_AGENT_VERSION }}) is behind local agent version (${{env.AGENT_VERSION}}); exiting." + exit 1; - name: Set package filename run: | From dc090c5abbefe9415f755985018677f85abe1492 Mon Sep 17 00:00:00 2001 From: mrickard Date: Fri, 18 Oct 2024 14:49:38 -0400 Subject: [PATCH 2/2] ci: Changed delay to increase with each iteration Signed-off-by: mrickard --- .github/workflows/azure-site-extension.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/azure-site-extension.yml b/.github/workflows/azure-site-extension.yml index 87b5adceb1..10a09cd3a9 100644 --- a/.github/workflows/azure-site-extension.yml +++ b/.github/workflows/azure-site-extension.yml @@ -50,10 +50,13 @@ jobs: if: ${{ env.NPM_AGENT_VERSION != env.AGENT_VERSION }} run: | $count = 0 + $seconds = 30 while($count -lt 10) { - Start-Sleep -s 120 + $seconds = ($seconds * $count) + echo "Sleeping $seconds ($count)" + Start-Sleep -s $seconds $npmversion = npm view newrelic version - echo "Checking npm ($count): $npmversion" + echo "Checking npm version ($count): $npmversion" $test = [Version]$npmversion -match [Version]${{ env.AGENT_VERSION }} if ([Version]$npmversion -match [Version]${{ env.AGENT_VERSION }}) { break;