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 2 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
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project_name: tilt
before:
hooks:
- ./scripts/upload-assets.py latest
- ./scripts/upload-assets.py latest --no_check
builds:
- env:
main: ./cmd/tilt/main.go
Expand Down Expand Up @@ -49,7 +49,7 @@ dockers:
- "tiltdev/tilt"
- "tiltdev/tilt:{{ .Tag }}"
dockerfile: scripts/goreleaser.Dockerfile

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

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('--no_check', action='store_true',
help='Don\'t check if files already exist before attempting to upload them')
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([
Expand All @@ -28,12 +28,17 @@
dir_url = ("https://storage.googleapis.com/tilt-static-assets/%s/" % version)
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)
sys.exit(1)

if not args.no_check:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a risk this will get us into a weird state where two releases are on top of each other? do we need to delete the old folder if it exists?

status = subprocess.call([
"gsutil", "stat", "gs://tilt-static-assets/%s/index.html" % version
])
if status == 0:
print("Error: Files already exist: {}".format(url))
print("You can manually delete the file(s) at:")
print("\thttps://console.cloud.google.com/storage/browser/tilt-static-assets"+
"?forceOnBucketsSortingFiltering=false&project=windmill-prod&prefix={}".format(version))
sys.exit(1)

os.chdir("web")
subprocess.check_call(["yarn", "install"])
Expand Down