Skip to content

Commit 38e8cc6

Browse files
Cr 13423 fix1 (#522)
* changed workflow parameters in demo pipelines * removed usage of deprecated io/ioutil package to fix lint
1 parent 7871d36 commit 38e8cc6

File tree

9 files changed

+19
-50
lines changed

9 files changed

+19
-50
lines changed

Makefile

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

33

44
OUT_DIR=dist

cmd/commands/git-source.go

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14+
1415
package commands
1516

1617
import (
@@ -242,7 +243,7 @@ func RunGitSourceCreate(ctx context.Context, opts *GitSourceCreateOptions) error
242243
}
243244

244245
if version.LessThan(appProxyGitSourceSupport) {
245-
log.G(ctx).Warnf("runtime \"%s\" is using a depracated git-source api. Versions %s and up use the app-proxy for this command. You are using version: %s", opts.RuntimeName, appProxyGitSourceSupport, version.String())
246+
log.G(ctx).Warnf("runtime \"%s\" is using a deprecated git-source api. Versions %s and up use the app-proxy for this command. You are using version: %s", opts.RuntimeName, appProxyGitSourceSupport, version.String())
246247
return legacyGitSourceCreate(ctx, opts)
247248
}
248249

@@ -895,8 +896,6 @@ func createDemoGithubTrigger() sensorsv1alpha1.Trigger {
895896
})
896897
workflowResource := apicommon.NewResource(workflow)
897898

898-
resultMsgPrefix := "Commit was pushed to branch: "
899-
900899
return sensorsv1alpha1.Trigger{
901900
Template: &sensorsv1alpha1.TriggerTemplate{
902901
Name: store.Get().DemoGitTriggerTemplateName,
@@ -907,14 +906,6 @@ func createDemoGithubTrigger() sensorsv1alpha1.Trigger {
907906
},
908907
Parameters: []sensorsv1alpha1.TriggerParameter{
909908
{
910-
Src: &sensorsv1alpha1.TriggerParameterSource{
911-
DependencyName: store.Get().DemoGitDependencyName,
912-
Value: &resultMsgPrefix,
913-
},
914-
Dest: "spec.arguments.parameters.0.value",
915-
},
916-
{
917-
Operation: sensorsv1alpha1.TriggerParameterOpAppend,
918909
Src: &sensorsv1alpha1.TriggerParameterSource{
919910
DependencyName: store.Get().DemoGitDependencyName,
920911
DataTemplate: "{{ trimPrefix \"refs/heads/\" .Input.body.ref }}",
@@ -1017,8 +1008,6 @@ func createDemoBitbucketServerTrigger() sensorsv1alpha1.Trigger {
10171008
})
10181009
workflowResource := apicommon.NewResource(workflow)
10191010

1020-
resultMsgPrefix := "Commit was pushed to branch: "
1021-
10221011
return sensorsv1alpha1.Trigger{
10231012
Template: &sensorsv1alpha1.TriggerTemplate{
10241013
Name: store.Get().DemoGitTriggerTemplateName,
@@ -1029,14 +1018,6 @@ func createDemoBitbucketServerTrigger() sensorsv1alpha1.Trigger {
10291018
},
10301019
Parameters: []sensorsv1alpha1.TriggerParameter{
10311020
{
1032-
Src: &sensorsv1alpha1.TriggerParameterSource{
1033-
DependencyName: store.Get().DemoGitDependencyName,
1034-
Value: &resultMsgPrefix,
1035-
},
1036-
Dest: "spec.arguments.parameters.0.value",
1037-
},
1038-
{
1039-
Operation: sensorsv1alpha1.TriggerParameterOpAppend,
10401021
Src: &sensorsv1alpha1.TriggerParameterSource{
10411022
DependencyName: store.Get().DemoGitDependencyName,
10421023
DataTemplate: "{{ (first .Input.body.changes).ref.displayId }}",
@@ -1139,8 +1120,6 @@ func createDemoGitlabTrigger() sensorsv1alpha1.Trigger {
11391120
})
11401121
workflowResource := apicommon.NewResource(workflow)
11411122

1142-
resultMsgPrefix := "Commit was pushed to branch: "
1143-
11441123
return sensorsv1alpha1.Trigger{
11451124
Template: &sensorsv1alpha1.TriggerTemplate{
11461125
Name: store.Get().DemoGitTriggerTemplateName,
@@ -1151,14 +1130,6 @@ func createDemoGitlabTrigger() sensorsv1alpha1.Trigger {
11511130
},
11521131
Parameters: []sensorsv1alpha1.TriggerParameter{
11531132
{
1154-
Src: &sensorsv1alpha1.TriggerParameterSource{
1155-
DependencyName: store.Get().DemoGitDependencyName,
1156-
Value: &resultMsgPrefix,
1157-
},
1158-
Dest: "spec.arguments.parameters.0.value",
1159-
},
1160-
{
1161-
Operation: sensorsv1alpha1.TriggerParameterOpAppend,
11621133
Src: &sensorsv1alpha1.TriggerParameterSource{
11631134
DependencyName: store.Get().DemoGitDependencyName,
11641135
DataTemplate: "{{ trimPrefix \"refs/heads/\" .Input.body.ref }}",

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.0.465/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.466/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.0.465/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.466/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/cmd-docs/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package main
1616

1717
import (
1818
"io/fs"
19-
"io/ioutil"
2019
"log"
2120
"os"
2221
"path/filepath"
@@ -69,7 +68,7 @@ func replaceHome() error {
6968

7069
log.Printf("replaced home at: %s", fname)
7170

72-
err = ioutil.WriteFile(fname, []byte(newstr), 0422)
71+
err = os.WriteFile(fname, []byte(newstr), 0422)
7372
if err != nil {
7473
return err
7574
}

hack/license.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package main
1717
import (
1818
"flag"
1919
"fmt"
20-
"io/ioutil"
20+
"io"
2121
"log"
2222
"os"
2323
"path/filepath"
@@ -42,7 +42,7 @@ func main() {
4242
panic("--year positive int required")
4343
}
4444

45-
d, err := ioutil.ReadFile(licenseFile)
45+
d, err := os.ReadFile(licenseFile)
4646
die(err)
4747

4848
license := string(d)
@@ -61,7 +61,7 @@ func main() {
6161
die(err)
6262
defer f.Close()
6363

64-
data, err := ioutil.ReadAll(f)
64+
data, err := io.ReadAll(f)
6565
die(err)
6666

6767
s := string(data)

manifests/runtime.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: "{{ namespace }}"
66
spec:
77
defVersion: 1.0.1
8-
version: 0.0.465
8+
version: 0.0.466
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

pkg/config/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"errors"
2121
"fmt"
2222
"io"
23-
"io/ioutil"
2423
"net/http"
2524
"os"
2625
"path/filepath"
@@ -144,7 +143,7 @@ func (c *Config) Save() error {
144143
return err
145144
}
146145

147-
return ioutil.WriteFile(filepath.Join(c.path, configFileName), data, 0644)
146+
return os.WriteFile(filepath.Join(c.path, configFileName), data, 0644)
148147
}
149148

150149
// GetCurrentContext returns current authentication context

pkg/runtime/runtime.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ package runtime
1717
import (
1818
"context"
1919
"fmt"
20-
"io/ioutil"
20+
"io"
2121
"net/http"
2222
"net/url"
23+
"os"
2324
"strconv"
2425
"strings"
2526
"time"
@@ -98,12 +99,12 @@ func Download(version *semver.Version, name string) (*Runtime, error) {
9899
}
99100

100101
defer res.Body.Close()
101-
body, err = ioutil.ReadAll(res.Body)
102+
body, err = io.ReadAll(res.Body)
102103
if err != nil {
103104
return nil, fmt.Errorf("failed to read runtime definition data: %w", err)
104105
}
105106
} else {
106-
body, err = ioutil.ReadFile(store.RuntimeDefURL)
107+
body, err = os.ReadFile(store.RuntimeDefURL)
107108
if err != nil {
108109
return nil, fmt.Errorf("failed to read runtime definition data: %w", err)
109110
}

pkg/util/kust/util.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ package util
1616

1717
import (
1818
"fmt"
19-
"io/ioutil"
2019
"os"
2120
"path/filepath"
2221

2322
"github.com/argoproj-labs/argocd-autopilot/pkg/fs"
2423
"github.com/ghodss/yaml"
25-
"sigs.k8s.io/kustomize/kyaml/filesys"
2624
"sigs.k8s.io/kustomize/api/krusty"
2725
kusttypes "sigs.k8s.io/kustomize/api/types"
26+
"sigs.k8s.io/kustomize/kyaml/filesys"
2827
)
2928

3029
var KUSTOMOZATION_FILE_NAME = "kustomization.yaml"
@@ -66,7 +65,7 @@ func WriteKustomization(fs fs.FS, kust *kusttypes.Kustomization, directory strin
6665
}
6766

6867
func BuildKustomization(k *kusttypes.Kustomization) ([]byte, error) {
69-
td, err := ioutil.TempDir(".", "csdp-add-cluster")
68+
td, err := os.MkdirTemp(".", "csdp-add-cluster")
7069
if err != nil {
7170
return nil, err
7271
}
@@ -78,7 +77,7 @@ func BuildKustomization(k *kusttypes.Kustomization) ([]byte, error) {
7877
}
7978

8079
kustomizationPath := filepath.Join(td, "kustomization.yaml")
81-
if err = ioutil.WriteFile(kustomizationPath, kyaml, 0400); err != nil {
80+
if err = os.WriteFile(kustomizationPath, kyaml, 0400); err != nil {
8281
return nil, err
8382
}
8483

@@ -92,4 +91,4 @@ func BuildKustomization(k *kusttypes.Kustomization) ([]byte, error) {
9291
}
9392

9493
return res.AsYaml()
95-
}
94+
}

0 commit comments

Comments
 (0)