Skip to content

Commit

Permalink
build: stop uploading assets to S3 (#34112)
Browse files Browse the repository at this point in the history
* build: remove S3 uploads

* build: remove ending slash upload-index-json (#34125)

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
  • Loading branch information
3 people committed May 7, 2022
1 parent 37eab5c commit eb320cb
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 98 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Expand Up @@ -14,6 +14,7 @@ parameters:
type: boolean
default: false

# TODO (vertedinde): migrate this variable to upload-to-az
upload-to-s3:
type: string
default: '1'
Expand Down
7 changes: 1 addition & 6 deletions script/lib/azput.js
Expand Up @@ -20,12 +20,7 @@ let anErrorOccurred = false;
function next (done) {
const file = files.shift();
if (!file) return done();
let key = filenameToKey(file);
// TODO: When we drop s3put, migrate the key to not include atom-shell in the callsites
key = key.replace('atom-shell/dist/', 'headers/dist/');
key = key.replace('atom-shell/symbols/', 'symbols/');
key = key.replace('atom-shell/tmp/', 'checksums-scratchpad/');
key = key.replace('electron-artifacts/', 'release-builds/');
const key = filenameToKey(file);

const [containerName, ...keyPath] = key.split('/');
const blobKey = keyPath.join('/');
Expand Down
11 changes: 0 additions & 11 deletions script/lib/config.py
Expand Up @@ -53,17 +53,6 @@ def get_env_var(name):
return value


def s3_config():
config = (get_env_var('S3_BUCKET'),
get_env_var('S3_ACCESS_KEY'),
get_env_var('S3_SECRET_KEY'))
message = ('Error: Please set the $ELECTRON_S3_BUCKET, '
'$ELECTRON_S3_ACCESS_KEY, and '
'$ELECTRON_S3_SECRET_KEY environment variables')
assert all(len(c) for c in config), message
return config


def enable_verbose_mode():
print('Running in verbose mode')
global verbose_mode
Expand Down
40 changes: 0 additions & 40 deletions script/lib/s3put.js

This file was deleted.

21 changes: 2 additions & 19 deletions script/lib/util.py
Expand Up @@ -20,7 +20,7 @@
from urllib2 import urlopen
import zipfile

from lib.config import is_verbose_mode, s3_config
from lib.config import is_verbose_mode

ELECTRON_DIR = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
Expand Down Expand Up @@ -161,26 +161,9 @@ def get_electron_version():
return 'v' + f.read().strip()

def store_artifact(prefix, key_prefix, files):
# Legacy S3 Bucket
s3put(prefix, key_prefix, files)
# New AZ Storage
# Azure Storage
azput(prefix, key_prefix, files)

def s3put(prefix, key_prefix, files):
bucket, access_key, secret_key = s3_config()
env = os.environ.copy()
env['AWS_ACCESS_KEY_ID'] = access_key
env['AWS_SECRET_ACCESS_KEY'] = secret_key
output = execute([
'node',
os.path.join(os.path.dirname(__file__), 's3put.js'),
'--bucket', bucket,
'--prefix', prefix,
'--key_prefix', key_prefix,
'--grant', 'public-read',
] + files, env)
print(output)

def azput(prefix, key_prefix, files):
env = os.environ.copy()
output = execute([
Expand Down
11 changes: 0 additions & 11 deletions script/release/release.js
Expand Up @@ -78,8 +78,6 @@ async function validateReleaseAssets (release, validatingRelease) {
console.log(`${fail} error verifyingShasums`, err);
});
}
const s3RemoteFiles = s3RemoteFilesForVersion(release.tag_name);
await verifyShasumsForRemoteFiles(s3RemoteFiles, true);
const azRemoteFiles = azRemoteFilesForVersion(release.tag_name);
await verifyShasumsForRemoteFiles(azRemoteFiles, true);
}
Expand Down Expand Up @@ -196,15 +194,6 @@ const cloudStoreFilePaths = (version) => [
'SHASUMS256.txt'
];

function s3RemoteFilesForVersion (version) {
const bucket = 'https://gh-contractor-zcbenz.s3.amazonaws.com/';
const versionPrefix = `${bucket}atom-shell/dist/${version}/`;
return cloudStoreFilePaths(version).map((filePath) => ({
file: filePath,
url: `${versionPrefix}${filePath}`
}));
}

function azRemoteFilesForVersion (version) {
const azCDN = 'https://artifacts.electronjs.org/headers/';
const versionPrefix = `${azCDN}dist/${version}/`;
Expand Down
2 changes: 1 addition & 1 deletion script/release/uploaders/upload-index-json.py
Expand Up @@ -59,7 +59,7 @@ def main():
with open(index_json, "wb") as f:
f.write(new_content)

store_artifact(OUT_DIR, 'atom-shell/dist', [index_json])
store_artifact(OUT_DIR, 'headers/dist', [index_json])


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion script/release/uploaders/upload-node-checksums.py
Expand Up @@ -29,7 +29,7 @@ def main():
]

if args.target_dir is None:
store_artifact(directory, 'atom-shell/dist/{0}'.format(args.version),
store_artifact(directory, 'headers/dist/{0}'.format(args.version),
checksums)
else:
copy_files(checksums, args.target_dir)
Expand Down
10 changes: 5 additions & 5 deletions script/release/uploaders/upload-node-headers.py
Expand Up @@ -45,9 +45,9 @@ def upload_node(version):
versioned_header_tar = header_tar.format(version)
shutil.copy2(generated_tar, os.path.join(GEN_DIR, versioned_header_tar))

store_artifact(GEN_DIR, 'atom-shell/dist/{0}'.format(version),
store_artifact(GEN_DIR, 'headers/dist/{0}'.format(version),
glob.glob('node-*.tar.gz'))
store_artifact(GEN_DIR, 'atom-shell/dist/{0}'.format(version),
store_artifact(GEN_DIR, 'headers/dist/{0}'.format(version),
glob.glob('iojs-*.tar.gz'))

if PLATFORM == 'win32':
Expand All @@ -73,13 +73,13 @@ def upload_node(version):
shutil.copy2(electron_lib, v4_node_lib)

# Upload the node.lib.
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version), [node_lib])
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version), [node_lib])

# Upload the iojs.lib.
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version), [iojs_lib])
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version), [iojs_lib])

# Upload the v4 node.lib.
store_artifact(DIST_DIR, 'atom-shell/dist/{0}'.format(version),
store_artifact(DIST_DIR, 'headers/dist/{0}'.format(version),
[v4_node_lib])


Expand Down
4 changes: 2 additions & 2 deletions script/release/uploaders/upload-symbols.py
Expand Up @@ -56,7 +56,7 @@ def main():

files += glob.glob(SYMBOLS_DIR + '/*/*/*.src.zip')

# The file upload needs to be atom-shell/symbols/:symbol_name/:hash/:symbol
# The file upload needs to be symbols/:symbol_name/:hash/:symbol
os.chdir(SYMBOLS_DIR)
files = [os.path.relpath(f, os.getcwd()) for f in files]

Expand Down Expand Up @@ -84,7 +84,7 @@ def run_symstore(pdb, dest, product):


def upload_symbols(files):
store_artifact(SYMBOLS_DIR, 'atom-shell/symbols',
store_artifact(SYMBOLS_DIR, 'symbols',
files)


Expand Down
5 changes: 3 additions & 2 deletions script/release/uploaders/upload.py
Expand Up @@ -333,8 +333,9 @@ def upload_electron(release, file_path, args):
pass

# if upload_to_s3 is set, skip github upload.
# todo (vertedinde): migrate this variable to upload_to_az
if args.upload_to_s3:
key_prefix = 'electron-artifacts/{0}_{1}'.format(args.version,
key_prefix = 'release-builds/{0}_{1}'.format(args.version,
args.upload_timestamp)
store_artifact(os.path.dirname(file_path), key_prefix, [file_path])
upload_sha256_checksum(args.version, file_path, key_prefix)
Expand All @@ -359,7 +360,7 @@ def upload_io_to_github(release, filename, filepath, version):
def upload_sha256_checksum(version, file_path, key_prefix=None):
checksum_path = '{}.sha256sum'.format(file_path)
if key_prefix is None:
key_prefix = 'atom-shell/tmp/{0}'.format(version)
key_prefix = 'checksums-scratchpad/{0}'.format(version)
sha256 = hashlib.sha256()
with open(file_path, 'rb') as f:
sha256.update(f.read())
Expand Down

0 comments on commit eb320cb

Please sign in to comment.