Skip to content

Commit

Permalink
TUN-8581: create dry run for github release
Browse files Browse the repository at this point in the history
  • Loading branch information
lmpn committed Aug 1, 2024
1 parent ae7f7fa commit b03ea05
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ cloudflared-pkg: cloudflared cloudflared.1
cloudflared-msi:
wixl --define Version=$(VERSION) --define Path=$(EXECUTABLE_PATH) --output cloudflared-$(VERSION)-$(TARGET_ARCH).msi cloudflared.wxs

.PHONY: github-release-dryrun
github-release-dryrun:
python3 github_release.py --path $(PWD)/built_artifacts --release-version $(VERSION) --dry-run

.PHONY: github-release
github-release:
python3 github_release.py --path $(PWD)/built_artifacts --release-version $(VERSION)
Expand Down
16 changes: 15 additions & 1 deletion cfsetup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,23 @@ buster: &buster
- component-tests/requirements.txt
pre-cache: *component_test_pre_cache
post-cache: *component_test_post_cache
github-release-dryrun:
build_dir: *build_dir
builddeps:
- *pinned_go
- build-essential
- python3-dev
- libffi-dev
- python3-setuptools
- python3-pip
pre-cache:
- pip3 install pynacl==1.4.0
- pip3 install pygithub==1.55
post-cache:
- make github-release-dryrun
github-release:
build_dir: *build_dir
builddeps:
builddeps:
- *pinned_go
- build-essential
- python3-dev
Expand Down
12 changes: 10 additions & 2 deletions github_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from github import Github, GithubException, UnknownObjectException

FORMAT = "%(levelname)s - %(asctime)s: %(message)s"
logging.basicConfig(format=FORMAT)
logging.basicConfig(format=FORMAT, level=logging.INFO)

CLOUDFLARED_REPO = os.environ.get("GITHUB_REPO", "cloudflare/cloudflared")
GITHUB_CONFLICT_CODE = "already_exists"
Expand Down Expand Up @@ -219,7 +219,15 @@ def main():
release = get_or_create_release(repo, args.release_version, args.dry_run)

if args.dry_run:
logging.info("Skipping asset upload because of dry-run")
if os.path.isdir(args.path):
onlyfiles = [f for f in listdir(args.path) if isfile(join(args.path, f))]
for filename in onlyfiles:
binary_path = os.path.join(args.path, filename)
logging.info("binary: " + binary_path)
elif os.path.isfile(args.path):
logging.info("binary: " + binary_path)
else:
logging.error("dryrun failed")
return

if os.path.isdir(args.path):
Expand Down

0 comments on commit b03ea05

Please sign in to comment.