Bug 1308903 - Update TC docker image at least every month r=franziskus
authorTim Taubert <ttaubert@mozilla.com>
Mon, 10 Oct 2016 15:50:43 +0200
changeset 12694 d9b87af2a0537ca63745b9ce2203741182e5e3f9
parent 12693 19235044514fb03ba9ee3e3b8ccc82d90ef0ff3d
child 12701 295feaebef58b62c89e9ee0f7b71408c74e18db2
push id1648
push userttaubert@mozilla.com
push dateMon, 10 Oct 2016 13:53:51 +0000
reviewersfranziskus
bugs1308903
Bug 1308903 - Update TC docker image at least every month r=franziskus Differential Revision: https://nss-dev.phacility.com/D77
automation/taskcluster/graph/src/context_hash.js
automation/taskcluster/graph/src/image_builder.js
--- a/automation/taskcluster/graph/src/context_hash.js
+++ b/automation/taskcluster/graph/src/context_hash.js
@@ -31,10 +31,13 @@ function collectFilesInDirectory(dir) {
 export default function (context_path) {
   let root = path.join(__dirname, "../../../..");
   let dir = path.join(root, context_path);
   let files = collectFilesInDirectory(dir).sort();
   let hashes = files.map(file => {
     return sha256(file + "|" + fs.readFileSync(file, "utf-8"));
   });
 
-  return sha256(hashes.join(","));
+  // Generate a new prefix every month to ensure the image stays buildable.
+  let now = new Date();
+  let prefix = `${now.getUTCFullYear()}-${now.getUTCMonth() + 1}:`;
+  return sha256(prefix + hashes.join(","));
 }
--- a/automation/taskcluster/graph/src/image_builder.js
+++ b/automation/taskcluster/graph/src/image_builder.js
@@ -40,17 +40,17 @@ export async function buildTask({name, p
       HEAD_REF: process.env.NSS_HEAD_REVISION,
       PROJECT: process.env.TC_PROJECT,
       CONTEXT_PATH: path,
       HASH: hash
     },
     artifacts: {
       "public/image.tar": {
         type: "file",
-        expires: 24 * 365,
+        expires: 24 * 90,
         path: "/artifacts/image.tar"
       }
     },
     command: [
       "/bin/bash",
       "-c",
       "/home/worker/bin/build_image.sh"
     ],