Skip to content

Commit

Permalink
change path string
Browse files Browse the repository at this point in the history
  • Loading branch information
rizul2108 committed Aug 26, 2023
1 parent 56f86f0 commit ae31af8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
github.com/xdg-go/pbkdf2 v1.0.0
go.mongodb.org/mongo-driver v1.12.1
golang.org/x/crypto v0.12.0
Expand Down Expand Up @@ -74,6 +75,7 @@ require (
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
Expand Down
11 changes: 10 additions & 1 deletion lib/utils/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func Tar(src string, writers ...io.Writer) error {
return err
}

header.Name = strings.TrimPrefix("./"+file, src+string(filepath.Separator))
header.Name = strings.TrimPrefix(file, src+string(filepath.Separator))
if err := tw.WriteHeader(header); err != nil {
return err
}
Expand Down Expand Up @@ -69,3 +69,12 @@ func RunCommand(cmd string) error {

return nil
}

func GetPath() (string, error) {
katanaDir, err := os.Getwd()
if err != nil {
fmt.Println("Error:", err)
return "", nil
}
return katanaDir, nil
}
4 changes: 2 additions & 2 deletions services/challengedeployerservice/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ func ChallengeUpdate(c *fiber.Ctx) error {
if err != nil {
log.Println("Error pulling changes:", err)
}

katanaDir, err := utils.GetPath()
imageName := strings.Replace(dir, "/", "-", -1)

log.Println("Pull successful for", teamName, ". Building image...")
firstPatch := !utils.DockerImageExists(imageName)
utils.BuildDockerImage(imageName, "./teams/"+dir)
utils.BuildDockerImage(imageName, katanaDir+"/teams/"+dir)

if firstPatch {
log.Println("First Patch for", teamName)
Expand Down
3 changes: 2 additions & 1 deletion services/infrasetservice/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ func envVariables(gogs string, pwd string, podNamespace string) {
}

func buildKatanaServices() {
katanaServicesDir := "./katana-services"
katanaDir, err := utils.GetPath()
katanaServicesDir := katanaDir + "/katana-services"

services, err := os.ReadDir(katanaServicesDir)
if err != nil {
Expand Down

0 comments on commit ae31af8

Please sign in to comment.