mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-13 12:41:21 +00:00
parent
214e10ef17
commit
a0a58c560d
2 changed files with 6 additions and 6 deletions
|
@ -208,7 +208,7 @@ func PostHook(c *gin.Context) {
|
|||
|
||||
// persist the build config for historical correctness, restarts, etc
|
||||
for _, remoteYamlConfig := range remoteYamlConfigs {
|
||||
_, err := findOrPersistPipelineConfig(build, remoteYamlConfig)
|
||||
_, err := findOrPersistPipelineConfig(repo, build, remoteYamlConfig)
|
||||
if err != nil {
|
||||
logrus.Errorf("failure to find or persist build config for %s. %s", repo.FullName, err)
|
||||
c.AbortWithError(500, err)
|
||||
|
@ -330,7 +330,7 @@ func zeroSteps(build *model.Build, remoteYamlConfigs []*remote.FileMeta) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func findOrPersistPipelineConfig(build *model.Build, remoteYamlConfig *remote.FileMeta) (*model.Config, error) {
|
||||
func findOrPersistPipelineConfig(repo *model.Repo, build *model.Build, remoteYamlConfig *remote.FileMeta) (*model.Config, error) {
|
||||
sha := shasum(remoteYamlConfig.Data)
|
||||
conf, err := Config.Storage.Config.ConfigFindIdentical(build.RepoID, sha)
|
||||
if err != nil {
|
||||
|
@ -338,7 +338,7 @@ func findOrPersistPipelineConfig(build *model.Build, remoteYamlConfig *remote.Fi
|
|||
RepoID: build.RepoID,
|
||||
Data: string(remoteYamlConfig.Data),
|
||||
Hash: sha,
|
||||
Name: sanitizePath(remoteYamlConfig.Name),
|
||||
Name: sanitizePath(remoteYamlConfig.Name, repo.Config),
|
||||
}
|
||||
err = Config.Storage.Config.ConfigCreate(conf)
|
||||
if err != nil {
|
||||
|
|
|
@ -78,7 +78,7 @@ func (b *procBuilder) Build() ([]*buildItem, error) {
|
|||
PGID: pidSequence,
|
||||
State: model.StatusPending,
|
||||
Environ: axis,
|
||||
Name: sanitizePath(y.Name),
|
||||
Name: sanitizePath(y.Name, b.Repo.Config),
|
||||
}
|
||||
|
||||
metadata := metadataFromStruct(b.Repo, b.Curr, b.Last, proc, b.Link)
|
||||
|
@ -358,9 +358,9 @@ func metadataFromStruct(repo *model.Repo, build, last *model.Build, proc *model.
|
|||
}
|
||||
}
|
||||
|
||||
func sanitizePath(path string) string {
|
||||
func sanitizePath(path string, configFolder string) string {
|
||||
path = strings.TrimSuffix(path, ".yml")
|
||||
path = strings.TrimPrefix(path, ".drone/")
|
||||
path = strings.TrimPrefix(path, configFolder)
|
||||
path = strings.TrimPrefix(path, ".")
|
||||
return path
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue