Skip to content

Commit 22311fd

Browse files
separate ref and runtime version (#642)
1 parent 1fcf2ae commit 22311fd

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.7
1+
VERSION=v0.1.8
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/runtime_install.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,26 +2132,20 @@ func (opts *RuntimeInstallOptions) IsCustomInstall() bool {
21322132
return opts.runtimeDef != store.RuntimeDefURL && opts.runtimeDef != store.OldRuntimeDefURL
21332133
}
21342134

2135-
func getRuntimeDef(runtimeDef, versionStr string) string {
2135+
func getRuntimeDef(runtimeDef, version string) string {
21362136
if !strings.HasPrefix(runtimeDef, "http") {
21372137
// runtimeDef is some local file
21382138
return runtimeDef
21392139
}
21402140

2141-
if versionStr == "" {
2141+
if version == "" {
21422142
// no specific version string
21432143
return runtimeDef
21442144
}
21452145

2146-
version, err := semver.NewVersion(versionStr)
2147-
if err != nil {
2148-
// should not arrive here, since we check for validateVersionIfExists earlier
2149-
return runtimeDef
2150-
}
2151-
21522146
// specific version means the runtimeDef is the default value in cli-v2/csdp-official repo
21532147
if strings.Contains(runtimeDef, "cli-v2") {
2154-
return strings.Replace(runtimeDef, "/releases/latest/download", "/releases/download/v"+version.String(), 1)
2148+
return strings.Replace(runtimeDef, "/releases/latest/download", "/releases/download/v"+version, 1)
21552149
}
2156-
return strings.Replace(runtimeDef, "stable", version.String(), 1)
2150+
return strings.Replace(runtimeDef, "stable", version, 1)
21572151
}

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.7/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.8/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.7/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.8/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

pkg/runtime/runtime.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ type (
6565
DefVersion *semver.Version `json:"defVersion"`
6666
RequiredCLIVersion string `json:"requiredCLIVersion"`
6767
Version *semver.Version `json:"version"`
68+
Ref string `json:"ref"`
6869
BootstrapSpecifier string `json:"bootstrapSpecifier"`
6970
Components []AppDef `json:"components"`
7071
Cluster string `json:"cluster"`
@@ -300,11 +301,19 @@ func (a *RuntimeSpec) component(name string) *AppDef {
300301

301302
func (r *RuntimeSpec) FullSpecifier() string {
302303
url := r.BootstrapSpecifier
303-
return buildFullURL(url, r.Version.String())
304+
ref := r.Version.String()
305+
if r.Ref != "" {
306+
ref = r.Ref
307+
}
308+
return buildFullURL(url, ref)
304309
}
305310

306311
func (r *RuntimeSpec) fullURL(url string) string {
307-
return buildFullURL(url, r.Version.String())
312+
ref := r.Version.String()
313+
if r.Ref != "" {
314+
ref = r.Ref
315+
}
316+
return buildFullURL(url, ref)
308317
}
309318

310319
// A component with no "Feature" value (or "") will always be installed

0 commit comments

Comments
 (0)