canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #00442
[Merge] ~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2:update_pipeline into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2:update_pipeline into autopkgtest-cloud:master.
Commit message:
remove readthedocs build from pipeline, update lint dependency
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2/+merge/443815
remove readthedocs build from pipeline, update lint dependency
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2:update_pipeline into autopkgtest-cloud:master.
diff --git a/.launchpad.yaml b/.launchpad.yaml
index f812f7e..6dca924 100755
--- a/.launchpad.yaml
+++ b/.launchpad.yaml
@@ -1,20 +1,9 @@
pipeline:
- - readthedocs_build
- lint_test
jobs:
lint_test:
series: focal
architectures: amd64
- packages: [pylint, python3, shellcheck]
+ packages: [pylint, python3, shellcheck, yamllint]
run: ./ci/lint_test
- readthedocs_build:
- series: focal
- packages: [python3-pip,
- python3,
- git,
- python3-requests,
- python3-git,
- yamllint]
- architectures: amd64
- run: python3 ./ci/trigger_readthedocs_build
diff --git a/ci/trigger_readthedocs_build b/ci/trigger_readthedocs_build
deleted file mode 100755
index 46762dd..0000000
--- a/ci/trigger_readthedocs_build
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python3
-#pylint: disable=invalid-name
-'''
-Script intended to be run after commit to master in the autopkgtest-cloud repository
-Triggers a build of the readthedocs repo for this repo
-'''
-import sys
-import time
-import logging
-import requests
-import git
-
-
-def get_latest_commit(repo_url):
- '''
- Acquire latest commit to master
- '''
- git.Repo.clone_from(repo_url, "./new_repo")
- return git.Git("./new_repo").log('-1', '-X')
-
-
-def check_if_commit_affected_docs():
- '''
- Checks if latest commit to master of autopkgtest-cloud
- had any changes under the docs directory
- '''
- latest_commit_message = get_latest_commit("https://git.launchpad.net/autopkgtest-cloud")
-
- arr = latest_commit_message.split("\n")
- for a in arr:
- x = a.split(" ")
- if len(x) > 2:
- if "%" in x[1]:
- dir_of_percent = x[2]
- if dir_of_percent == "docs/":
- return True
- return False
-
-
-if __name__=="__main__":
- logging.basicConfig(level=logging.INFO)
- logger = logging.getLogger('readthedocs_build_triggerer')
- auth_token="replace-with-working-token"
- rtd_headers={'Authorization': f'token {auth_token}'}
- build_tr_url='https://readthedocs.org/api/v3/projects/autopkgtest-cloud/versions/latest/builds/'
-
- if not check_if_commit_affected_docs():
- logger.info("Latest commit to master didn't affect docs directory, not triggering build.")
- sys.exit(0)
- else:
- logger.info("Latest commit did affect docs directory, building on readthedocs")
- try:
- response1 = requests.post(build_tr_url, headers=rtd_headers)
- except Exception as _:
- logger.info("Tried to trigger readthedocs build but it failed!")
- sys.exit(0)
- build_no = str(response1.json()["build"]["id"])
- build_info_url='https://readthedocs.org/api/v3/projects/autopkgtest-cloud/builds/' + build_no
- logger.info("Build started at: %s", build_info_url)
- timeout=300
- start = time.time()
- while True:
- response2 = requests.get(build_info_url, headers=rtd_headers).json()
- build_state = response2["state"]["code"]
- if response2["finished"] is not None:
- logger.info("Build finished")
- exit_code = response2["success"]
- if exit_code:
- logger.info("Build success")
- sys.exit(0)
- else:
- logger.error("Build failed")
- sys.exit(1)
- time.sleep(1)
- if (time.time() - start) > timeout:
- logger.error("Build timed out")
- sys.exit(1)
Follow ups