mirror of
https://github.com/caprover/caprover
synced 2026-09-25 08:05:35 +00:00
CAPROVER_GIT_COMMIT_SHA for Method 3 - fixed https://github.com/caprover/caprover/issues/1198
This commit is contained in:
@@ -123,6 +123,18 @@ export default class ImageMaker {
|
||||
})
|
||||
.then(function (gitHashFromImageSource) {
|
||||
gitHash = gitHashFromImageSource
|
||||
|
||||
const includesGitCommitEnvVar = envVars.find(
|
||||
(envVar) => envVar.key === CaptainConstants.gitShaEnvVarKey
|
||||
)
|
||||
|
||||
if (gitHash && !includesGitCommitEnvVar) {
|
||||
envVars.push({
|
||||
key: CaptainConstants.gitShaEnvVarKey,
|
||||
value: gitHash,
|
||||
})
|
||||
}
|
||||
|
||||
// some users convert the directory into TAR instead of converting the content into TAR.
|
||||
// we go one level deep and try to find the right directory.
|
||||
// Also, they may have no captain-definition file, in that case, fall back to Dockerfile if exists.
|
||||
|
||||
@@ -169,20 +169,6 @@ class ServiceManager {
|
||||
.then(function (app) {
|
||||
const envVars = app.envVars || []
|
||||
|
||||
const includesGitCommitEnvVar = envVars.find(
|
||||
(envVar) =>
|
||||
envVar.key === CaptainConstants.gitShaEnvVarKey
|
||||
)
|
||||
const gitHash =
|
||||
source.captainDefinitionContentSource?.gitHash ||
|
||||
source.uploadedTarPathSource?.gitHash
|
||||
if (gitHash && !includesGitCommitEnvVar) {
|
||||
envVars.push({
|
||||
key: CaptainConstants.gitShaEnvVarKey,
|
||||
value: gitHash,
|
||||
})
|
||||
}
|
||||
|
||||
return self.imageMaker.ensureImage(
|
||||
source,
|
||||
appName,
|
||||
|
||||
Reference in New Issue
Block a user