Skip to content

Commit 3b2604a

Browse files
authored
Merge pull request #138 from robertsirc/update-to-gh-actions
Update to gh actions
2 parents 7c1fcc2 + de944df commit 3b2604a

10 files changed

+134
-5
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/issue_template.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- If you need help or think you have found a bug, please help us with your issue by entering the following information (otherwise you can delete this text): -->
2+
3+
Output of `helm version`:
4+
5+
Output of `helm-mapkubeapis`:
6+
7+
Output of `kubectl version`:
8+
9+
Cloud Provider/Platform (AKS, GKE, EKS, etc.):

.github/pull_request_template.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Thanks for sending a pull request! Here are some tips for you:
2+
1. Make sure to read the Contributing Guide before submitting your PR:
3+
https://github.com/helm/helm-mapkubeapis/blob/main/CONTRIBUTING.md
4+
2. If this PR closes another issue, add 'closes #<issue number>' somewhere in the PR summary. GitHub will automatically close that issue when this PR gets merged. Alternatively, adding 'refs #<issue number>' will not close the issue, but help provide the reviewer more context.-->
5+
6+
**What this PR does / why we need it**:
7+
8+
**Special notes for your reviewer**:
9+
10+
**If applicable**:
11+
- [ ] this PR contains documentation
12+
- [ ] this PR contains unit tests
13+
- [ ] this PR has been tested for backwards compatibility

.github/workflows/build-test.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: build-test
5+
6+
on:
7+
push:
8+
branches:
9+
- "main"
10+
- "release-**"
11+
pull_request:
12+
branches:
13+
- main
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout source code
20+
uses: actions/checkout@v4
21+
- name: Set up Go
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: "1.22"
25+
- name: Run Test
26+
run: make test
27+
- name: Build
28+
run: make build

.github/workflows/golangci-lint.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: golangci-lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
golangci:
9+
name: golangci-lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout source code
13+
uses: actions/checkout@v4
14+
- name: Set up Go
15+
uses: actions/setup-go@v4
16+
with:
17+
go-version: "1.22"
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v6
20+
with:
21+
version: v1.58

.github/workflows/goreleaser.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: goreleaser
2+
3+
on:
4+
create:
5+
tags:
6+
- v*
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
goreleaser:
16+
runs-on: ubuntu-latest
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
-
24+
name: Set Up Go
25+
uses: actions/setup-go@v5
26+
-
27+
name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v6
29+
with:
30+
distribution: goreleaser
31+
version: '~> v2'
32+
args: release --clean
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ bin/
22
dist/
33
tmp/
44
releases/
5+
6+
.idea/

cmd/mapkubeapis/map.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ func newMapCmd(out io.Writer, args []string) *cobra.Command {
4949
SilenceUsage: true,
5050
Args: func(cmd *cobra.Command, args []string) error {
5151
if len(args) == 0 {
52-
cmd.Help()
52+
err := cmd.Help()
53+
if err != nil {
54+
return err
55+
}
5356
os.Exit(1)
5457
} else if len(args) > 1 {
5558
return errors.New("only one release name may be passed at a time")
@@ -61,7 +64,12 @@ func newMapCmd(out io.Writer, args []string) *cobra.Command {
6164
}
6265

6366
flags := cmd.PersistentFlags()
64-
flags.Parse(args)
67+
flags.ParseErrorsWhitelist.UnknownFlags = true
68+
err := flags.Parse(args)
69+
if err != nil {
70+
return nil
71+
}
72+
6573
settings = new(EnvSettings)
6674

6775
// Get the default mapping file

pkg/mapping/mapfile.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ limitations under the License.
1717
package mapping
1818

1919
import (
20-
"io/ioutil"
20+
"os"
2121

2222
"sigs.k8s.io/yaml"
2323
)
2424

2525
// LoadMapfile loads a Map.yaml file into a *Metadata.
2626
func LoadMapfile(filename string) (*Metadata, error) {
27-
b, err := ioutil.ReadFile(filename)
27+
b, err := os.ReadFile(filename)
2828
if err != nil {
2929
return nil, err
3030
}

pkg/v3/connect.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ func GetActionConfig(namespace string, kubeConfig common.KubeConfig) (*action.Co
5555
func debug(format string, v ...interface{}) {
5656
if settings.Debug {
5757
format = fmt.Sprintf("[debug] %s\n", format)
58-
log.Output(2, fmt.Sprintf(format, v...))
58+
err := log.Output(2, fmt.Sprintf(format, v...))
59+
if err != nil {
60+
return
61+
}
5962
}
6063
}

0 commit comments

Comments
 (0)