Skip to content

Commit

Permalink
Update archive filename with timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Jul 6, 2024
1 parent c06d62f commit 5c0032f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions __main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime
import os
import tempfile
import zipfile
Expand All @@ -8,7 +9,10 @@

load_dotenv()

PROJECT_NAME = f"{pulumi.get_stack()}-{pulumi.get_project()}"
PROJECT_NAME = f"{pulumi.get_project()}-{pulumi.get_stack()}"

# Generate a timestamp for versioning
TIMESTAMP = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")

config = pulumi.Config()
TELEGRAM_BOT_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN")
Expand All @@ -28,8 +32,12 @@ def create_zip(files_to_zip):

bucket = gcp.storage.Bucket("bucket", name=f"{PROJECT_NAME}-bucket", location="ASIA")


# Create a more descriptive archive name
archive_name = f"{PROJECT_NAME}-function-{TIMESTAMP}.zip"

archive = gcp.storage.BucketObject(
"archive", bucket=bucket.name, source=pulumi.FileAsset(zip_path)
"archive", bucket=bucket.name, name=archive_name, source=pulumi.FileAsset(zip_path)
)


Expand Down

0 comments on commit 5c0032f

Please sign in to comment.