kube-workflow
Advanced tools
Comparing version 1.17.3 to 1.18.0
{ | ||
"name": "kube-workflow-common", | ||
"version": "1.17.3", | ||
"version": "1.18.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,4 +0,4 @@ | ||
const shell = require("./shell") | ||
const asyncShell = require("./async-shell") | ||
module.exports = (cwd = process.cwd()) => | ||
shell("git branch --show-current", { cwd }).trim() | ||
module.exports = async (cwd = process.cwd()) => | ||
(await asyncShell("git branch --show-current", { cwd })).trim() |
const repositoryFromGitUrl = require("./repository-from-git-url") | ||
const getGitUrl = require("./get-git-url") | ||
module.exports = (cwd = process.cwd(), url = getGitUrl(cwd)) => | ||
repositoryFromGitUrl(url) | ||
module.exports = async (cwd = process.cwd(), url = null) => { | ||
if (!url) { | ||
url = await getGitUrl(cwd) | ||
} | ||
return repositoryFromGitUrl(url) | ||
} |
@@ -1,4 +0,6 @@ | ||
const shell = require("./shell") | ||
const asyncShell = require("./async-shell") | ||
module.exports = (cwd = process.cwd()) => | ||
shell("git show -s --format=%H", { cwd }).trim() | ||
module.exports = async (cwd = process.cwd(), branch = "HEAD") => { | ||
const res = await asyncShell(`git rev-parse ${branch}`, { cwd }) | ||
return res.trim() | ||
} |
@@ -1,7 +0,7 @@ | ||
const shell = require("./shell") | ||
const asyncShell = require("./async-shell") | ||
module.exports = (cwd = process.cwd()) => { | ||
module.exports = async (cwd = process.cwd()) => { | ||
let GIT_TAGS | ||
try { | ||
GIT_TAGS = shell("git tag --points-at HEAD", { cwd }) | ||
GIT_TAGS = (await asyncShell("git tag --points-at HEAD", { cwd })) | ||
.split("\n") | ||
@@ -8,0 +8,0 @@ .map((tag) => tag.trim()) |
@@ -1,4 +0,4 @@ | ||
const shell = require("./shell") | ||
const asyncShell = require("./async-shell") | ||
module.exports = (cwd = process.cwd()) => | ||
shell("git remote get-url origin", { cwd }).trim() | ||
module.exports = async (cwd = process.cwd()) => | ||
(await asyncShell("git remote get-url origin", { cwd })).trim() |
const { createHash } = require("crypto") | ||
const slugify = require("slugify") | ||
slugify.extend({ "!": "-", ".": "-", "/": "-", "@": "-", _: "-", "~": "-" }) | ||
slugify.extend({ | ||
"!": "-", | ||
".": "-", | ||
"/": "-", | ||
"@": "-", | ||
_: "-", | ||
"~": "-", | ||
":": "-", | ||
}) | ||
@@ -6,0 +14,0 @@ const KUBERNETS_MAX_NAME_LENGTH = 63 |
@@ -53,5 +53,5 @@ const path = require("path") | ||
await fs.writeFile(kubeconfigFile, yaml.dump(kubeconfig)) | ||
await fs.chmod(kubeconfigFile, 0o400) | ||
process.env.KUBECONFIG = kubeconfigFile | ||
console.log(yaml.dump(kubeconfig)) | ||
} | ||
} |
{ | ||
"name": "kube-workflow", | ||
"version": "1.17.3", | ||
"version": "1.18.0", | ||
"repository": "git@github.com:SocialGouv/kube-workflow.git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -40,6 +40,6 @@ const os = require("os") | ||
Object.assign(envVars, getGitInfos(envVars.WORKSPACE_PATH, envVars, true)) | ||
Object.assign(envVars, await getGitInfos(envVars.WORKSPACE_PATH, envVars, true)) | ||
if(!envVars.ENVIRONMENT){ | ||
envVars.ENVIRONMENT = selectEnv({ options, cwd: envVars.WORKSPACE_PATH, env: envVars }) | ||
envVars.ENVIRONMENT = await selectEnv({ options, cwd: envVars.WORKSPACE_PATH, env: envVars }) | ||
} | ||
@@ -46,0 +46,0 @@ |
@@ -20,2 +20,4 @@ const { configureDebug } = require("~common/utils/logger") | ||
.addOption(options.set) | ||
.addOption(options.rancherProjectName) | ||
.addOption(options.rancherProjectId) | ||
.option( | ||
@@ -26,10 +28,2 @@ "--file, -f <file>", | ||
.option( | ||
"--rancher-project-name <project>", | ||
"rancher project name, default to repository basename" | ||
) | ||
.option( | ||
"--rancher-project-id <project-id>", | ||
"rancher project id, default retrieved from ci namespace" | ||
) | ||
.option( | ||
"--kubeconfig-context <context>", | ||
@@ -36,0 +30,0 @@ "kubeconfig context, default inferred from environment" |
@@ -21,3 +21,3 @@ const selectEnv = require("~/utils/select-env") | ||
buildCtx.provide() | ||
const env = selectEnv({ | ||
const env = await selectEnv({ | ||
opts, | ||
@@ -24,0 +24,0 @@ ref, |
@@ -9,3 +9,4 @@ const program = require("./program") | ||
require("./command.commit-token") | ||
require("./command.logs") | ||
module.exports = (args = process.argv) => program.parse(args) |
@@ -43,1 +43,11 @@ const { Option } = require("commander") | ||
module.exports.upload = new Option("--upload <url>", "upload manifests to url") | ||
module.exports.rancherProjectName = new Option( | ||
"--rancher-project-name <project>", | ||
"rancher project name, default to repository basename" | ||
) | ||
module.exports.rancherProjectId = new Option( | ||
"--rancher-project-id <project-id>", | ||
"rancher project id, default retrieved from ci namespace" | ||
) |
@@ -26,7 +26,7 @@ const path = require("path") | ||
const cwd = options.cwd || process.cwd() | ||
const { GIT_REPOSITORY } = getGitInfos(cwd) | ||
const { GIT_REPOSITORY } = await getGitInfos(cwd) | ||
const repositoryName = path.basename(GIT_REPOSITORY) | ||
const selectedEnv = selectEnv({ options, cwd }) | ||
const selectedEnv = await selectEnv({ options, cwd }) | ||
@@ -33,0 +33,0 @@ let kubeconfigContext = |
@@ -11,3 +11,3 @@ const logger = require("~common/utils/logger") | ||
module.exports = ( | ||
module.exports = async ( | ||
cwd = process.cwd(), | ||
@@ -22,4 +22,6 @@ env = buildCtx.get("env") || process.env, | ||
infos.GIT_TAGS = env.GIT_TAGS.split(",") | ||
} else if (env.GIT_TAGS === undefined || env.GIT_TAGS === null) { | ||
infos.GIT_TAGS = await getGitTags(cwd) | ||
} else { | ||
infos.GIT_TAGS = getGitTags(cwd) | ||
infos.GIT_TAGS = [] | ||
} | ||
@@ -30,3 +32,3 @@ } | ||
env.GIT_REF || | ||
getGitRef(cwd) || | ||
(await getGitRef(cwd)) || | ||
infos.GIT_TAGS.filter((t) => isVersionTag(t)) | ||
@@ -37,3 +39,3 @@ .sort() | ||
if (!infos.GIT_SHA) { | ||
infos.GIT_SHA = env.GIT_SHA || getGitSha(cwd) | ||
infos.GIT_SHA = env.GIT_SHA || (await getGitSha(cwd)) | ||
} | ||
@@ -43,3 +45,6 @@ if (!infos.GIT_REPOSITORY) { | ||
env.GIT_REPOSITORY || | ||
getGitRepository(cwd, env.GIT_REPOSITORY_URL || getGitUrl(cwd)) | ||
(await getGitRepository( | ||
cwd, | ||
env.GIT_REPOSITORY_URL || (await getGitUrl(cwd)) | ||
)) | ||
} | ||
@@ -46,0 +51,0 @@ } catch (e) { |
const isVersionTag = require("~common/utils/is-version-tag") | ||
const refEnv = require("~common/utils/ref-env") | ||
const getGitInfos = require("~/utils/get-git-infos") | ||
@@ -8,3 +9,3 @@ | ||
module.exports = ({ | ||
module.exports = async ({ | ||
options = {}, | ||
@@ -25,23 +26,10 @@ cwd, | ||
if (ref) { | ||
ref = ref.replace("refs/heads/", "").replace("refs/tags/", "") | ||
if (ref === "master" || ref === "main") { | ||
return "preprod" | ||
} | ||
if (isVersionTag(ref)) { | ||
return "prod" | ||
} | ||
return "dev" | ||
return refEnv(ref) | ||
} | ||
const { GIT_REF, GIT_TAGS } = getGitInfos(cwd, env) | ||
const { GIT_REF, GIT_TAGS } = await getGitInfos(cwd, env) | ||
if (detectCurrentTags && GIT_TAGS.some((tag) => isVersionTag(tag))) { | ||
return "prod" | ||
} | ||
if (isVersionTag(GIT_REF)) { | ||
return "prod" | ||
} | ||
if (GIT_REF === "master" || GIT_REF === "main") { | ||
return "preprod" | ||
} | ||
return "dev" | ||
return refEnv(GIT_REF) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
111734
115
2054
50