Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-check option for asset uploading, default for release #3304

Merged
merged 6 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ scoop:
homepage: "https://tilt.dev/"
description: "Tilt powers multi-service developments for teams that deploy to Kubernetes."
license: Apache-2.0

# Uncomment these lines if you want to experiment with other
# parts of the release process without releasing new binaries.
# release:
Expand Down
25 changes: 19 additions & 6 deletions scripts/upload-assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,47 @@

import argparse
import os
import re
import subprocess
import sys


parser = argparse.ArgumentParser(description='Upload JS assets')
parser.add_argument('--force', dest='feature', action='store_true',
help='Re-upload files even if they already exist')
parser.add_argument('--clean', action='store_true',
help='Instead of uploading assets, delete assets of the given version (if they exist)')
parser.add_argument('version', help='A version string like "v1.2.3".')
args = parser.parse_args()
version = args.version
if version == "latest":
version = str(subprocess.check_output([
"git", "describe", "--tags", "--abbrev=0"
])).strip()

dir_url = ("https://storage.googleapis.com/tilt-static-assets/%s/" % version)

if args.clean:
# Just remove the bucket and exit w/o uploading anything
print("Deleting bucket at %s (if exists)" % dir_url)
subprocess.call(["gsutil", "-m", "rm", "-r", "gs://tilt-static-assets/%s" % version],
# (If bucket DNE, this will error but that's expected; suppress STDERR)
stderr=open(os.devnull, 'wb'))
sys.exit(0)

url = dir_url + "index.html"
print("Uploading to %s" % dir_url)
status = subprocess.call([
"gsutil", "stat", "gs://tilt-static-assets/%s/index.html" % version
])
if status == 0:
print("Error: Files already exist: %s" % url)
print("Error: bucket already exists at: %s" % url)
print("Remove the bucket by running this script with --clean,")
print("or manually delete the bucket at:")
print("\thttps://console.cloud.google.com/storage/browser/tilt-static-assets"+
"?forceOnBucketsSortingFiltering=false&project=windmill-prod&prefix=%s" % version)
print("Then try uploading assets again.")
sys.exit(1)

os.chdir("web")
subprocess.check_call(["yarn", "install"])
e = os.environ.copy()
e["CI"] = "false"
subprocess.check_call(["yarn", "run", "build"], env=e)
subprocess.check_call(["gsutil", "cp", "-r", "build", "gs://tilt-static-assets/%s" % version])
subprocess.check_call(["gsutil", "-m", "cp", "-r", "build", "gs://tilt-static-assets/%s" % version])