Skip to content

Commit

Permalink
Merge pull request #11 from sighupio/feature/git-via-https
Browse files Browse the repository at this point in the history
git via https
  • Loading branch information
angelbarrera92 authored Jan 7, 2020
2 parents 53ea482 + 730d8e7 commit 686b0b5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

version = v0.1.3
version = v0.1.4

tag:
git tag $(version)
Expand All @@ -8,8 +8,8 @@ build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o bin/linux/$(version)/furyctl .
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o bin/darwin/$(version)/furyctl .
mkdir -p bin/{darwin,linux}/latest
cp -u bin/darwin/$(version)/furyctl bin/darwin/latest/furyctl
cp -u bin/linux/$(version)/furyctl bin/linux/latest/furyctl
cp bin/darwin/$(version)/furyctl bin/darwin/latest/furyctl
cp bin/linux/$(version)/furyctl bin/linux/latest/furyctl

upload-to-s3:
aws s3 sync bin s3://sighup-releases --endpoint-url=https://s3.wasabisys.com --exclude '*' --include 'linux/$(version)/furyctl' --include 'darwin/$(version)/furyctl' --include 'darwin/latest/furyctl' --include 'linux/latest/furyctl'
Expand Down
14 changes: 11 additions & 3 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import (

const (
configFile = "Furyfile"
repoPrefix = "[email protected]:sighupio/fury-kubernetes"
httpsRepoPrefix = "git::https://github.com/sighupio/fury-kubernetes"
sshRepoPrefix = "[email protected]:sighupio/fury-kubernetes"
defaultVendorFolderName = "vendor"
)

Expand Down Expand Up @@ -72,6 +73,13 @@ func (f *Furyconf) Parse() ([]Package, error) {
pkgs = append(pkgs, v)
}

repoPrefix := sshRepoPrefix
dotGitParticle := ""
if https {
repoPrefix = httpsRepoPrefix
dotGitParticle = ".git"
}

// Now we generate the dowload url and local dir
for i := 0; i < len(pkgs); i++ {
version := pkgs[i].Version
Expand All @@ -86,9 +94,9 @@ func (f *Furyconf) Parse() ([]Package, error) {
}
block := strings.Split(pkgs[i].Name, "/")
if len(block) == 2 {
pkgs[i].url = fmt.Sprintf("%s-%s//%s/%s?ref=%s", repoPrefix, block[0], pkgs[i].kind, block[1], version)
pkgs[i].url = fmt.Sprintf("%s-%s%s//%s/%s?ref=%s", repoPrefix, block[0], dotGitParticle, pkgs[i].kind, block[1], version)
} else if len(block) == 1 {
pkgs[i].url = fmt.Sprintf("%s-%s//%s?ref=%s", repoPrefix, block[0], pkgs[i].kind, version)
pkgs[i].url = fmt.Sprintf("%s-%s%s//%s?ref=%s", repoPrefix, block[0], dotGitParticle, pkgs[i].kind, version)
}
pkgs[i].dir = fmt.Sprintf("%s/%s/%s", f.VendorFolderName, pkgs[i].kind, pkgs[i].Name)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

var parallel bool
var https bool

func download(packages []Package) error {
// Preparing all the necessary data for a worker pool
Expand Down
1 change: 1 addition & 0 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
func init() {
rootCmd.AddCommand(installCmd)
installCmd.PersistentFlags().BoolVarP(&parallel, "parallel", "p", true, "if true enables parallel downloads")
installCmd.PersistentFlags().BoolVarP(&https, "https", "H", false, "if true downloads using https instead of ssh")
}

// installCmd represents the install command
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
package cmd

// FuryctlVersion is the version of the client
const FuryctlVersion = "0.1.3"
const FuryctlVersion = "0.1.4"

0 comments on commit 686b0b5

Please sign in to comment.