Skip to content

Commit 836420f

Browse files
committed
Adding more validations during the publish step, to verify openshot.org/download has correct URLs, which include the new version, and that all URLs are valid (no 404s).
1 parent b4483ee commit 836420f

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

.gitlab-ci.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ deployer:
137137
artifacts:
138138
expire_in: 4 weeks
139139
paths:
140-
- build\build-server.log
140+
- build/*.log
141+
- build/*.sha256sum
142+
- build/*.verify
143+
- build/*.torrent
141144
script:
142145
- python3 -u installer/deploy.py "$SLACK_TOKEN" "$GITHUB_USER" "$GITHUB_PASS" "False"
143146
when: manual
@@ -153,7 +156,7 @@ publisher:
153156
artifacts:
154157
expire_in: 4 weeks
155158
paths:
156-
- build\build-server.log
159+
- build/*.log
157160
script:
158161
- python3 -u installer/deploy.py "$SLACK_TOKEN" "$GITHUB_USER" "$GITHUB_PASS" "True"
159162
when: manual

installer/deploy.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434
import urllib3
3535
from github3 import login
3636
from requests.auth import HTTPBasicAuth
37-
from requests import post, get
37+
from requests import post, get, head
3838
from build_server import output, run_command, error, truncate, zulip_upload_log, get_release, upload, \
3939
errors_detected, log, version_info, parse_version_info
4040

4141
PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) # Primary openshot folder
4242
RELEASE_NAME_REGEX = re.compile(r'^OpenShot-v.*?(-.*?)-x86[_64]*')
43+
DOWNLOAD_PAGE_URLS = re.compile(r'"(//github.com/OpenShot/openshot-qt/releases/download/v.*?/OpenShot-.*?)"',
44+
re.MULTILINE)
4345

4446
# Access info class (for version info)
4547
sys.path.append(os.path.join(PATH, 'src', 'classes'))
@@ -266,6 +268,27 @@
266268
(r.status_code, os.getenv('OPENSHOT_ORG_USER'),
267269
r.json().get('message', 'no error message found')))
268270
else:
271+
# Verify download links on openshot.org are correct (and include the new release version)
272+
r = get("https://www.openshot.org/download/")
273+
if r.ok:
274+
# Find all release download URLs on openshot.org
275+
urls = DOWNLOAD_PAGE_URLS.findall(r.content.decode('UTF-8'))
276+
for url in urls:
277+
# Only GET the header of each URL, to validate it is valid and found
278+
r = head("https:" + url)
279+
if r.ok and r.reason == "Found":
280+
output("Validation of URL successful: %s" % url)
281+
else:
282+
raise Exception("Validation of URL FAILED: %s, %s, %s" % (url, r.status_code, r.reason))
283+
284+
# Validate the current version is found in each URL
285+
if version_info.get('openshot-qt', {}).get('VERSION', 'N/A') not in url:
286+
raise Exception("Validation of URL FAILED. Missing version %s: %s, %s, %s" %
287+
(version_info.get('openshot-qt', {}).get('VERSION', 'N/A'), url,
288+
r.status_code, r.reason))
289+
else:
290+
raise Exception("Failed to GET openshot.org/download for URL validation: %s" % r.status_code)
291+
269292
# Publish the release (make new version visible on openshot.org, and make blog post visible)
270293
auth = HTTPBasicAuth(os.getenv('OPENSHOT_ORG_USER'), os.getenv('OPENSHOT_ORG_PASS'))
271294
r = post("https://www.openshot.org/api/release/publish/", auth=auth, data={"version": github_release.tag_name })
@@ -274,6 +297,7 @@
274297
(r.status_code, os.getenv('OPENSHOT_ORG_USER'),
275298
r.json().get('message', 'no error message found')))
276299

300+
# Publish GitHub Release objects (in all 3 repos)
277301
for repo_name in repo_names:
278302
# If NO release is found, create a new one
279303
github_release = releases.get(repo_name)

0 commit comments

Comments
 (0)