chore: fix get-published-artifact script (#27610)

* chore: fix get-published-artifact scripts [run ci]

* update unit test, check linux-arm workflow [run ci]

* circle workflow getting cached?
This commit is contained in:
Adam Stone-Lord
2023-08-21 13:34:56 -04:00
committed by GitHub
parent be2f828d64
commit fe6f72f6c7
3 changed files with 13 additions and 5 deletions

View File

@@ -57,7 +57,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'chore/bump_loaders_and_optimize_webpack', << pipeline.git.branch >> ]
- equal: [ 'bump-circle-cache', << pipeline.git.branch >> ]
- equal: [ 'astone123/fix-get-published-artifacts', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
@@ -2119,7 +2119,7 @@ jobs:
name: Download binary artifacts
command: |
source ./scripts/ensure-node.sh
node ./scripts/binary/get-published-artifacts.js --pipelineInfo ~/triggered_pipeline.json
node ./scripts/binary/get-published-artifacts.js --pipelineInfo ~/triggered_pipeline.json --platformKey $(node ./scripts/get-platform-key.js)
- persist_to_workspace:
root: ~/
paths:

View File

@@ -7,7 +7,13 @@ const chalk = require('chalk')
const execPromise = util.promisify(exec)
const artifactJobName = 'publish-binary'
const getArtifactJobName = (platformKey) => {
if (platformKey === 'linux-x64') {
return 'linux-amd-publish-binary'
}
return 'publish-binary'
}
const urlPaths = [
'~/cypress/binary-url.json',
@@ -92,6 +98,8 @@ async function downloadArtifact (url, path) {
async function run (args) {
const options = minimist(args)
const artifactJobName = getArtifactJobName(options.platformKey)
const pipelineInfoFilePath = options.pipelineInfo
if (!pipelineInfoFilePath) {

View File

@@ -19,11 +19,11 @@ describe('get-published-artifacts', () => {
const getPipelineIdStub = sinon.stub(getPublishedArtifactsModule, 'getPipelineId').returns('abc123')
const getWorkflowsStub = sinon.stub(getPublishedArtifactsModule, 'getWorkflows').returns([{ id: 'my-workflow', name: 'linux-x64', status: 'success' }])
const getWorkflowJobsStub = sinon.stub(getPublishedArtifactsModule, 'getWorkflowJobs').returns([{ name: 'publish-binary', job_number: 2 }])
const getWorkflowJobsStub = sinon.stub(getPublishedArtifactsModule, 'getWorkflowJobs').returns([{ name: 'linux-amd-publish-binary', job_number: 2 }])
const getJobArtifactsStub = sinon.stub(getPublishedArtifactsModule, 'getJobArtifacts').returns(mockArtifacts)
const downloadArtifactStub = sinon.stub(getPublishedArtifactsModule, 'downloadArtifact')
await getPublishedArtifactsModule.run(['--pipelineInfo', 'foo'])
await getPublishedArtifactsModule.run(['--pipelineInfo', 'foo', '--platformKey', 'linux-x64'])
expect(getPipelineIdStub).to.have.been.calledWith('foo')
expect(getWorkflowsStub).to.have.been.calledWith('abc123')