add metadata to the uploaded test runner binary (#4092)

* move s3 api helpers into own TS file

* add demo file

* add comments

* add method to set user metadata by copying it

* set checksum metadata on uploaded binary

* move checksum to the right upload file

* call the right method

* fix require from ts

* convert size to string

* needs extension

* test binary against other projects

* set checksums as headers during first upload

* Revert "set checksums as headers during first upload"

This reverts commit 2043d9ee1f.

* set ACL to public-read when setting metadata on binary

* linting

* pass content-type

* update scripts tests

* linting

* add --platformArch parameter
This commit is contained in:
Gleb Bahmutov
2019-05-02 12:29:37 -04:00
committed by GitHub
parent e12edb8309
commit 6f685ab8b8
9 changed files with 273 additions and 97 deletions
+5 -4
View File
@@ -2,6 +2,7 @@ const snapshot = require('snap-shot-it')
const la = require('lazy-ass')
const is = require('check-more-types')
const uploadUtils = require('../../binary/util/upload')
const s3helpers = require('../../binary/s3-api').s3helpers
/* eslint-env mocha */
/* global sinon */
@@ -120,14 +121,14 @@ describe('move-binaries', () => {
// fake S3 api
const s3 = {}
sinon.stub(moveBinaries.s3helpers, 'makeS3').returns(s3)
sinon.stub(s3helpers, 'makeS3').returns(s3)
sinon
.stub(moveBinaries.s3helpers, 'listS3Objects')
.stub(s3helpers, 'listS3Objects')
.withArgs('beta/binary/3.3.0/darwin-x64', aws.bucket)
.resolves(darwinBuilds)
sinon
.stub(moveBinaries.s3helpers, 'verifyZipFileExists')
.stub(s3helpers, 'verifyZipFileExists')
.withArgs(`${latestMacBuild}cypress.zip`, aws.bucket)
.resolves()
@@ -135,7 +136,7 @@ describe('move-binaries', () => {
sinon.stub(moveBinaries.prompts, 'shouldCopy').resolves()
sinon
.stub(moveBinaries.s3helpers, 'copyS3')
.stub(s3helpers, 'copyS3')
.withArgs(
`${latestMacBuild}cypress.zip`,
'desktop/3.3.0/darwin-x64/cypress.zip',
+26
View File
@@ -0,0 +1,26 @@
const la = require('lazy-ass')
/* eslint-env mocha */
describe('s3-api', () => {
context('hasOnlyStringValues', () => {
const { hasOnlyStringValues } = require('../../binary/s3-api')
it('returns true if object has only string values', () => {
const o = {
foo: 'bar',
baz: 'baz',
}
la(hasOnlyStringValues(o))
})
it('returns false if object has non-string value', () => {
const o = {
foo: 'bar',
baz: 42,
}
la(!hasOnlyStringValues(o))
})
})
})