feature: initial support for specific git commit

This commit is contained in:
ThallesP
2022-10-25 13:26:03 -03:00
parent 1d93658e56
commit dfd29dc37a
10 changed files with 209 additions and 70 deletions

View File

@@ -1,10 +1,10 @@
COOLIFY_APP_ID=local-dev
# 32 bits long secret key
COOLIFY_SECRET_KEY=12341234123412341234123412341234
COOLIFY_DATABASE_URL=file:../db/dev.db
COOLIFY_SENTRY_DSN=
COOLIFY_IS_ON=docker
COOLIFY_WHITE_LABELED=false
COOLIFY_WHITE_LABELED_ICON=
COOLIFY_AUTO_UPDATE=
COOLIFY_APP_ID=local-dev
# 32 bits long secret key
COOLIFY_SECRET_KEY=12341234123412341234123412341234
COOLIFY_DATABASE_URL=file:../db/dev.db
COOLIFY_SENTRY_DSN=
COOLIFY_IS_ON=docker
COOLIFY_WHITE_LABELED=false
COOLIFY_WHITE_LABELED_ICON=
COOLIFY_AUTO_UPDATE=

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Application" ADD COLUMN "gitCommitHash" TEXT;

View File

@@ -124,6 +124,7 @@ model Application {
updatedAt DateTime @updatedAt
destinationDockerId String?
gitSourceId String?
gitCommitHash String?
baseImage String?
baseBuildImage String?
gitSource GitSource? @relation(fields: [gitSourceId], references: [id])

View File

@@ -60,6 +60,7 @@ import * as buildpacks from '../lib/buildPacks';
gitSource,
configHash,
fqdn,
gitCommitHash,
projectId,
secrets,
phpModules,
@@ -160,6 +161,8 @@ import * as buildpacks from '../lib/buildPacks';
githubAppId: gitSource.githubApp?.id,
gitlabAppId: gitSource.gitlabApp?.id,
customPort: gitSource.customPort,
gitCommitHash: gitCommitHash,
configuration,
repository,
branch,
buildId,

View File

@@ -9,6 +9,7 @@ export default async function ({
githubAppId,
repository,
apiUrl,
gitCommitHash,
htmlUrl,
branch,
buildId,
@@ -20,6 +21,7 @@ export default async function ({
githubAppId: string;
repository: string;
apiUrl: string;
gitCommitHash?: string;
htmlUrl: string;
branch: string;
buildId: string;
@@ -36,7 +38,7 @@ export default async function ({
applicationId
});
await asyncExecShell(
`git clone -q -b ${branch} https://${url}/${repository}.git ${workdir}/ && cd ${workdir} && git submodule update --init --recursive && git lfs pull && cd .. `
`git clone -q -b ${branch} https://${url}/${repository}.git ${workdir}/ && cd ${workdir} && git checkout ${gitCommitHash} && git submodule update --init --recursive && git lfs pull && cd .. `
);
} else {

View File

@@ -327,6 +327,7 @@ export async function saveApplication(request: FastifyRequest<SaveApplication>,
dockerFileLocation,
denoMainFile,
denoOptions,
gitCommitHash,
baseImage,
baseBuildImage,
deploymentType,
@@ -365,6 +366,7 @@ export async function saveApplication(request: FastifyRequest<SaveApplication>,
pythonVariable,
denoOptions,
baseImage,
gitCommitHash,
baseBuildImage,
deploymentType,
dockerComposeFile,
@@ -383,6 +385,7 @@ export async function saveApplication(request: FastifyRequest<SaveApplication>,
exposePort,
pythonWSGI,
pythonModule,
gitCommitHash,
pythonVariable,
denoOptions,
baseImage,

View File

@@ -19,6 +19,7 @@ export interface SaveApplication extends OnlyId {
denoMainFile: string,
denoOptions: string,
baseImage: string,
gitCommitHash: string,
baseBuildImage: string,
deploymentType: string,
baseDatabaseBranch: string,