Files
cypress/scripts/binary/s3-api-demo.ts
Gleb Bahmutov 6f685ab8b8 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
2019-05-02 12:29:37 -04:00

22 lines
626 B
TypeScript

// ignore TS errors - we are importing from CoffeeScript files
// @ts-ignore
import uploadUtils from './util/upload'
import { s3helpers } from './s3-api'
const aws = uploadUtils.getS3Credentials()
const s3 = s3helpers.makeS3(aws)
const bucket = aws.bucket
const key = 'beta/binary/3.3.0/darwin-x64/circle-develop-455046b928c861d4457b2ec5426a51de1fda74fd-102212/cypress.zip'
/*
a little demo showing how user metadata can be set and read on a S3 object.
*/
s3helpers.setUserMetadata(bucket, key, {
user: 'bar'
}, s3)
.then(() => {
return s3helpers.getUserMetadata(bucket, key, s3)
}).then(console.log, console.error)