fix: secrets

This commit is contained in:
Andras Bacsai 2022-12-19 22:11:21 +01:00
parent 29530f3b17
commit 47979bf16d
13 changed files with 47 additions and 47 deletions

View File

@ -148,13 +148,13 @@ import * as buildpacks from '../lib/buildPacks';
(s) => s.name === secret.name && s.isPRMRSecret
);
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
envs.push(`${secret.name}=${isSecretFound[0].value}`);
} else {
envs.push(`${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -162,7 +162,7 @@ import * as buildpacks from '../lib/buildPacks';
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -718,13 +718,13 @@ import * as buildpacks from '../lib/buildPacks';
(s) => s.name === secret.name && s.isPRMRSecret
);
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n') || isSecretFound[0].value.includes("'")) {
envs.push(`${secret.name}=${isSecretFound[0].value}`);
} else {
envs.push(`${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -732,7 +732,7 @@ import * as buildpacks from '../lib/buildPacks';
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);

View File

@ -792,13 +792,13 @@ export async function buildCacheImageWithNode(data, imageForBuild) {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter((s) => s.name === secret.name && s.isPRMRSecret);
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -806,7 +806,7 @@ export async function buildCacheImageWithNode(data, imageForBuild) {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -842,14 +842,14 @@ export async function buildCacheImageForLaravel(data, imageForBuild) {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -857,7 +857,7 @@ export async function buildCacheImageForLaravel(data, imageForBuild) {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -31,13 +31,13 @@ export default async function (data) {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter((s) => s.name === secret.name && s.isPRMRSecret);
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
envs.push(`${secret.name}='${isSecretFound[0].value}'`);
} else {
envs.push(`${secret.name}=${isSecretFound[0].value}`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -45,7 +45,7 @@ export default async function (data) {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);

View File

@ -29,14 +29,14 @@ const createDockerfile = async (data, image): Promise<void> => {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -44,7 +44,7 @@ const createDockerfile = async (data, image): Promise<void> => {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -21,7 +21,7 @@ export default async function (data) {
) {
Dockerfile.forEach((line, index) => {
if (line.startsWith('FROM')) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.splice(index + 1, 0, `ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.splice(index + 1, 0, `ARG ${secret.name}='${secret.value}'`);

View File

@ -29,13 +29,13 @@ const createDockerfile = async (data, image): Promise<void> => {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secrets.value.includes('\\n')) {
if (secrets.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -43,7 +43,7 @@ const createDockerfile = async (data, image): Promise<void> => {
}
} else {
if (!secret.isPRMRSecret) {
if (secrets.value.includes('\\n')) {
if (secrets.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -25,14 +25,14 @@ const createDockerfile = async (data, image): Promise<void> => {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -40,7 +40,7 @@ const createDockerfile = async (data, image): Promise<void> => {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -29,14 +29,14 @@ const createDockerfile = async (data, image): Promise<void> => {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -44,7 +44,7 @@ const createDockerfile = async (data, image): Promise<void> => {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -18,14 +18,14 @@ const createDockerfile = async (data, image, htaccessFound): Promise<void> => {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -33,7 +33,7 @@ const createDockerfile = async (data, image, htaccessFound): Promise<void> => {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -23,14 +23,14 @@ const createDockerfile = async (data, image): Promise<void> => {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -38,7 +38,7 @@ const createDockerfile = async (data, image): Promise<void> => {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -30,14 +30,14 @@ const createDockerfile = async (data, image): Promise<void> => {
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${isSecretFound[0].value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);
@ -45,7 +45,7 @@ const createDockerfile = async (data, image): Promise<void> => {
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
} else {
Dockerfile.push(`ARG ${secret.name}='${secret.value}'`);

View File

@ -468,14 +468,14 @@ export async function restartApplication(request: FastifyRequest<RestartApplicat
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
envs.push(`${secret.name}=${isSecretFound[0].value}`);
} else {
envs.push(`${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -483,7 +483,7 @@ export async function restartApplication(request: FastifyRequest<RestartApplicat
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -1182,13 +1182,13 @@ export async function restartPreview(request: FastifyRequest<RestartPreviewAppli
if (pullmergeRequestId) {
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n')|| isSecretFound[0].value.includes("'")) {
envs.push(`${secret.name}=${isSecretFound[0].value}`);
} else {
envs.push(`${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -1196,7 +1196,7 @@ export async function restartPreview(request: FastifyRequest<RestartPreviewAppli
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);

View File

@ -210,13 +210,13 @@ export const applicationsRouter = router({
if (pullmergeRequestId) {
const isSecretFound = secrets.filter((s) => s.name === secret.name && s.isPRMRSecret);
if (isSecretFound.length > 0) {
if (isSecretFound[0].value.includes('\\n')) {
if (isSecretFound[0].value.includes('\\n') || isSecretFound[0].value.includes("'")) {
envs.push(`${secret.name}=${isSecretFound[0].value}`);
} else {
envs.push(`${secret.name}='${isSecretFound[0].value}'`);
}
} else {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
@ -224,12 +224,12 @@ export const applicationsRouter = router({
}
} else {
if (!secret.isPRMRSecret) {
if (secret.value.includes('\\n')) {
if (secret.value.includes('\\n')|| secret.value.includes("'")) {
envs.push(`${secret.name}=${secret.value}`);
} else {
envs.push(`${secret.name}='${secret.value}'`);
}
}
}
}
});
}