CAPROVER_GIT_COMMIT_SHA for Method 3 - fixed https://github.com/caprover/caprover/issues/1198

This commit is contained in:
Kasra Bigdeli
2021-09-27 18:34:56 -07:00
parent 743ce1c4ca
commit d7eefe6835
2 changed files with 12 additions and 14 deletions
+12
View File
@@ -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.
-14
View File
@@ -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,