mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-03 23:04:53 -04:00
AB#2249 Rework image build pipeline (#326)
* Rework image build pipeline * Dont cancel workflow runs on main Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
d3435b06a2
commit
5da92d9d8b
22 changed files with 341 additions and 281 deletions
|
@ -3,6 +3,7 @@ package git
|
|||
import (
|
||||
"errors"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
git "github.com/go-git/go-git/v5"
|
||||
|
@ -77,6 +78,28 @@ func (g *Git) FirstParentWithVersionTag() (revision string, versionTag string, e
|
|||
return revision, versionTag, nil
|
||||
}
|
||||
|
||||
// ParsedBranchName returns the name of the current branch.
|
||||
// Special characters are replaced with "-", and the name is lowercased and trimmed to 49 characters.
|
||||
// This makes sure that the branch name is usable as a GCP image name.
|
||||
func (g *Git) ParsedBranchName() (string, error) {
|
||||
commitRef, err := g.repo.Head()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
rxp, err := regexp.Compile("[^a-zA-Z0-9-]+")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
branch := strings.ToLower(rxp.ReplaceAllString(commitRef.Name().Short(), "-"))
|
||||
if len(branch) > 49 {
|
||||
branch = branch[:49]
|
||||
}
|
||||
|
||||
return strings.TrimSuffix(branch, "-"), nil
|
||||
}
|
||||
|
||||
// tagsByRevisionHash returns a map from revision hash to a list of associated tags.
|
||||
func (g *Git) tagsByRevisionHash() (map[string][]string, error) {
|
||||
tags := make(map[string][]string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue