Skip to content

Commit b03ea05

Browse files
committed
TUN-8581: create dry run for github release
1 parent ae7f7fa commit b03ea05

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ cloudflared-pkg: cloudflared cloudflared.1
218218
cloudflared-msi:
219219
wixl --define Version=$(VERSION) --define Path=$(EXECUTABLE_PATH) --output cloudflared-$(VERSION)-$(TARGET_ARCH).msi cloudflared.wxs
220220

221+
.PHONY: github-release-dryrun
222+
github-release-dryrun:
223+
python3 github_release.py --path $(PWD)/built_artifacts --release-version $(VERSION) --dry-run
224+
221225
.PHONY: github-release
222226
github-release:
223227
python3 github_release.py --path $(PWD)/built_artifacts --release-version $(VERSION)

cfsetup.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,23 @@ buster: &buster
195195
- component-tests/requirements.txt
196196
pre-cache: *component_test_pre_cache
197197
post-cache: *component_test_post_cache
198+
github-release-dryrun:
199+
build_dir: *build_dir
200+
builddeps:
201+
- *pinned_go
202+
- build-essential
203+
- python3-dev
204+
- libffi-dev
205+
- python3-setuptools
206+
- python3-pip
207+
pre-cache:
208+
- pip3 install pynacl==1.4.0
209+
- pip3 install pygithub==1.55
210+
post-cache:
211+
- make github-release-dryrun
198212
github-release:
199213
build_dir: *build_dir
200-
builddeps:
214+
builddeps:
201215
- *pinned_go
202216
- build-essential
203217
- python3-dev

github_release.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from github import Github, GithubException, UnknownObjectException
1818

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

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

221221
if args.dry_run:
222-
logging.info("Skipping asset upload because of dry-run")
222+
if os.path.isdir(args.path):
223+
onlyfiles = [f for f in listdir(args.path) if isfile(join(args.path, f))]
224+
for filename in onlyfiles:
225+
binary_path = os.path.join(args.path, filename)
226+
logging.info("binary: " + binary_path)
227+
elif os.path.isfile(args.path):
228+
logging.info("binary: " + binary_path)
229+
else:
230+
logging.error("dryrun failed")
223231
return
224232

225233
if os.path.isdir(args.path):

0 commit comments

Comments
 (0)