You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Override ProjectID and BranchID by ENVs, if enabled
87
87
varmapping []mappingItem
88
88
ifcontent.AllowTargetENV {
89
-
projectIDStr:=envs.Get(ProjectIDOverrideENV)
90
-
branchIDStr:=envs.Get(BranchIDOverrideENV)
91
-
92
-
ifbranchIDStr!=""&&len(content.Branches) !=1 {
93
-
returnnil, errors.Errorf(`env %s=%s can be used if there is one branch in the manifest, found %d branches`, BranchIDOverrideENV, branchIDStr, len(content.Branches))
returnnil, errors.Errorf(`env %s=%s can be used if there is one branch in the manifest, found %d branches`, BranchIDOverrideENV, branchIDStr, len(content.Branches))
134
+
}
135
+
136
+
ifprojectIDStr!="" {
137
+
projectIDInt, err:=strconv.Atoi(projectIDStr)
138
+
iferr!=nil {
139
+
returnnil, errors.Errorf(`env %s=%s is not valid project ID`, ProjectIDOverrideENV, projectIDStr)
140
+
}
141
+
projectID:=keboola.ProjectID(projectIDInt)
142
+
ifprojectID!=content.Project.ID {
143
+
logger.Infof(ctx, `Overriding the project ID by the environment variable %s=%v`, ProjectIDOverrideENV, projectID)
144
+
mapping=append(mapping, mappingItem{
145
+
ManifestValue: content.Project.ID,
146
+
MemoryValue: projectID,
147
+
})
148
+
}
149
+
}
150
+
151
+
ifbranchIDStr!="" {
152
+
branchIDInt, err:=strconv.Atoi(branchIDStr)
153
+
iferr!=nil {
154
+
returnnil, errors.Errorf(`env %s=%s is not valid branch ID`, BranchIDOverrideENV, branchIDStr)
155
+
}
156
+
originalBranchID:=content.Branches[0].ID
157
+
replacedBranchID:=keboola.BranchID(branchIDInt)
158
+
ifreplacedBranchID!=content.Branches[0].ID {
159
+
logger.Infof(ctx, `Overriding the branch ID by the environment variable %s=%v`, BranchIDOverrideENV, replacedBranchID)
0 commit comments