Skip to content

Commit

Permalink
Limit groupIds to 63 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
jmandel committed Oct 10, 2023
1 parent 8ccf73a commit 67e9ee4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion triggers/ig-commit-trigger/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import functions from "@google-cloud/functions-framework";
import k8s from "@kubernetes/client-node";
import jobSource from "./job.json" assert { type: "json" };
import crypto from "crypto"


const kc = new k8s.KubeConfig();
kc.loadFromFile("sa.kubeconfig");
Expand Down Expand Up @@ -37,7 +39,8 @@ functions.http("ig-commit-trigger", async function (req, res) {
});
}

const jobGroupId = `igbuild-${org}-${repo}-${branch}`.toLocaleLowerCase();
const jobGroupId = crypto.createHash('sha256').update(`${org}-${repo}-${branch}`, 'utf8').digest('hex').slice(0, 63);
console.log("Job group id", jobGroupId);

const jobId = `igbuild-${commitHash.slice(0, 6)}-${org}-${repo}-${branch}`
.toLocaleLowerCase()
Expand Down

0 comments on commit 67e9ee4

Please sign in to comment.