Skip to content

Commit

Permalink
Repo clone ACL (#1720)
Browse files Browse the repository at this point in the history
* adjust ACLs on Repo Clone

* added git dir

---------

Co-authored-by: Roman Dodin <dodin.roman@gmail.com>
  • Loading branch information
steiler and hellt authored Nov 15, 2023
1 parent fab4221 commit f03b6fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- 'errors/**'
- 'cert/**'
- 'virt/**'
- 'git/**'
- 'border0_api/**'
- '.github/workflows/cicd.yml'
- 'go.mod'
Expand Down
7 changes: 7 additions & 0 deletions git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/storage/memory"
log "github.com/sirupsen/logrus"
"github.com/srl-labs/containerlab/utils"
)

type GoGit struct {
Expand Down Expand Up @@ -216,6 +217,12 @@ func (g *GoGit) cloneNonExisting() error {
}
co.ReferenceName = plumbing.NewBranchReferenceName(branchName)
}
// pre-create the repo directory and adjust the ACLs
utils.CreateDirectory(g.gitRepo.GetName(), 0755)
err = utils.AdjustFileACLs(g.gitRepo.GetName())
if err != nil {
log.Warnf("failed to adjust repository (%s) ACLs. continuin anyways", g.gitRepo.GetName())
}

// perform clone
g.r, err = gogit.PlainClone(g.gitRepo.GetName(), false, co)
Expand Down

0 comments on commit f03b6fa

Please sign in to comment.