Skip to content

Commit 8111859

Browse files
fix upgrade (#634)
* fix upgrade * bump * fix * fix --version
1 parent b41448b commit 8111859

File tree

7 files changed

+12
-16
lines changed

7 files changed

+12
-16
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.1
1+
VERSION=v0.1.2
22

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

cmd/commands/runtime.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -900,14 +900,6 @@ func runRuntimeUpgrade(ctx context.Context, opts *RuntimeUpgradeOptions) error {
900900
return fmt.Errorf("failed to load current runtime definition: %w", err)
901901
}
902902

903-
if !newRt.Spec.Version.GreaterThan(curRt.Spec.Version) {
904-
err = fmt.Errorf("current runtime version (%s) is greater than or equal to the specified version (%s)", curRt.Spec.Version, newRt.Spec.Version)
905-
}
906-
handleCliStep(reporter.UpgradeStepLoadRuntimeDefinition, "Comparing runtime versions", err, true, false)
907-
if err != nil {
908-
return err
909-
}
910-
911903
log.G(ctx).Infof("Upgrading runtime \"%s\" to version: v%s", opts.RuntimeName, newRt.Spec.Version)
912904
newComponents, err := curRt.Upgrade(fs, newRt, opts.CommonConfig)
913905
handleCliStep(reporter.UpgradeStepUpgradeRuntime, "Upgrading runtime", err, false, false)

cmd/commands/runtime_install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,5 +2153,5 @@ func getRuntimeDef(runtimeDef, versionStr string) string {
21532153
if strings.Contains(runtimeDef, "cli-v2") {
21542154
return strings.Replace(runtimeDef, "/releases/latest/download", "/releases/download/v"+version.String(), 1)
21552155
}
2156-
return runtimeDef + "?ref=v" + version.String()
2156+
return strings.Replace(runtimeDef, "stable", version.String(), 1)
21572157
}

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.1/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.2/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.1/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.2/cf-darwin-amd64.tar.gz | tar zx
4040

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

hack/get-manifests-location.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ BRANCH="$1"
55

66
DEFAULT_MANIFESTS_LOCATION="https://raw.githubusercontent.com/codefresh-io/csdp-official/stable/csdp/hybrid/basic/runtime.yaml"
77
RUNTIME_DEFINITION_URL="https://raw.githubusercontent.com/codefresh-io/csdp-official/$BRANCH/csdp/hybrid/basic/runtime.yaml"
8+
RUNTIME_DEFINITION_FILE="/codefresh/volume/runtime.yaml"
89

910
git ls-remote --heads ${REPO} ${BRANCH} | grep ${BRANCH} >/dev/null
1011

1112
if [ "$?" == "1" ]; then
1213
# No matching branch was found in csdp-official
13-
echo "$DEFAULT_MANIFESTS_LOCATION"
14+
curl --silent "$DEFAULT_MANIFESTS_LOCATION" > $RUNTIME_DEFINITION_FILE
15+
echo $RUNTIME_DEFINITION_FILE
1416
exit 0
1517
fi
1618

17-
RUNTIME_DEFINITION_FILE="/codefresh/volume/runtime.yaml"
18-
curl --silent "$RUNTIME_DEFINITION_URL" | yq "(.spec.components[] | select(.type == \"kustomize\") | .url) += \"?ref=$BRANCH\"" | yq ".spec.bootstrapSpecifier += \"?ref=$BRANCH\"" >$RUNTIME_DEFINITION_FILE
19+
curl --silent "$RUNTIME_DEFINITION_URL" | yq "(.spec.components[] | select(.type == \"kustomize\") | .url) += \"?ref=$BRANCH\"" | yq ".spec.bootstrapSpecifier += \"?ref=$BRANCH\"" > $RUNTIME_DEFINITION_FILE
1920
echo $RUNTIME_DEFINITION_FILE

pkg/runtime/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ func GetRuntimeDefURL(versionStr string) string {
504504

505505
version := semver.MustParse(versionStr)
506506
if version.Compare(store.Get().LastRuntimeVersionInCLI) <= 0 {
507-
runtimeDefURL = store.Get().RuntimeDefURL
507+
runtimeDefURL = store.Get().OldRuntimeDefURL
508508
}
509509

510510
return runtimeDefURL

pkg/util/kube/kube.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,9 @@ func DeleteSecretWithFinalizer(ctx context.Context, kubeFactory kube.Factory, se
625625
}
626626

627627
err = client.CoreV1().Secrets(secret.Namespace).Delete(ctx, secret.Name, metav1.DeleteOptions{})
628+
if errors.IsNotFound(err) {
629+
return nil
630+
}
628631

629632
return err
630633
}

0 commit comments

Comments
 (0)