mirror of
https://github.com/caprover/caprover
synced 2026-05-04 10:40:34 +00:00
Merge pull request #1049 from matt-oakes/git-sha
Set the CAPROVER_GIT_COMMIT_SHA env var automatically when building
This commit is contained in:
@@ -166,12 +166,29 @@ class ServiceManager {
|
||||
.getAppsDataStore()
|
||||
.getAppDefinition(appName)
|
||||
.then(function (app) {
|
||||
const envVars = app.envVars
|
||||
|
||||
const includesGitCommitEnvVar = envVars.find(
|
||||
(envVar) => envVar.key === 'CAPROVER_GIT_COMMIT_SHA'
|
||||
)
|
||||
const gitHash =
|
||||
source.captainDefinitionContentSource?.gitHash ||
|
||||
source.uploadedTarPathSource?.gitHash
|
||||
if (gitHash && !includesGitCommitEnvVar) {
|
||||
if (gitHash) {
|
||||
envVars.push({
|
||||
key: 'CAPROVER_GIT_COMMIT_SHA',
|
||||
value: gitHash,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return self.imageMaker.ensureImage(
|
||||
source,
|
||||
appName,
|
||||
app.captainDefinitionRelativeFilePath,
|
||||
appVersion,
|
||||
app.envVars
|
||||
envVars
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user