← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/qa-jenkins-jobs:fix-rtd-builds into qa-jenkins-jobs:master

 

Tim Andersson has proposed merging ~andersson123/qa-jenkins-jobs:fix-rtd-builds into qa-jenkins-jobs:master.

Requested reviews:
  Canonical Platform QA Team (canonical-platform-qa)

For more details, see:
https://code.launchpad.net/~andersson123/qa-jenkins-jobs/+git/qa-jenkins-jobs/+merge/474281

This was previously using a static file on venonat. I've added the relevant secret in jenkins and modified the job to use said secret.
-- 
Your team Canonical Platform QA Team is requested to review the proposed merge of ~andersson123/qa-jenkins-jobs:fix-rtd-builds into qa-jenkins-jobs:master.
diff --git a/jobs/autopkgtest-cloud/jobs.yaml b/jobs/autopkgtest-cloud/jobs.yaml
index b94bb7f..02771cb 100644
--- a/jobs/autopkgtest-cloud/jobs.yaml
+++ b/jobs/autopkgtest-cloud/jobs.yaml
@@ -29,6 +29,10 @@
                       - simple: true
     wrappers:
         - timestamps
+        - credentials-binding:
+            - text:
+                credential-id: RTD_TOKEN
+                variable: RTD_TOKEN
         - timeout:
             timeout: 5
             fail: true
@@ -42,14 +46,12 @@
             export https_proxy="http://squid.internal:3128";
             export no_proxy=launchpad.net
 
-            RTD_TOKEN=$(cat /var/lib/jenkins/autopkgtest-cloud-readthedocs-api-token)
-
-            RTD_LATEST_COMMIT=$(curl -H "Authorization: Token ${RTD_TOKEN}" https://readthedocs.org/api/v3/projects/autopkgtest-cloud/builds/ | jq -r '.results[0]' | jq -r '.commit')
+            RTD_LATEST_COMMIT=$(curl -H "Authorization: Token ${{RTD_TOKEN}}" https://readthedocs.org/api/v3/projects/autopkgtest-cloud/builds/ | jq -r '.results[0]' | jq -r '.commit')
             git clone https://git.launchpad.net/autopkgtest-cloud
             cd autopkgtest-cloud || exit 1
             if ! git diff --quiet "${RTD_LATEST_COMMIT}" docs/ .readthedocs.yaml; then
                 printf "Changes have been made to docs since last built version, building on readthedocs...\n"
-                curl -sS -X POST -H "Authorization: Token ${RTD_TOKEN}" https://readthedocs.org/api/v3/projects/autopkgtest-cloud/versions/latest/builds/
+                curl -sS -X POST -H "Authorization: Token ${{RTD_TOKEN}}" https://readthedocs.org/api/v3/projects/autopkgtest-cloud/versions/latest/builds/
                 printf "readthedocs build request submitted\n"
             else
                 printf "No changes to docs/ since latest build, not building\n"