Skip to content
Snippets Groups Projects
Commit 8d208075 authored by James Lu's avatar James Lu Committed by Derek Su
Browse files

fix: golangci-lint errors fixed


Signed-off-by: default avatarJames Lu <james.lu@suse.com>
parent 16f15ccd
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,9 @@ jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout Codes
uses: actions/checkout@v4
......@@ -20,8 +23,8 @@ jobs:
run: make ci
# Run e2e test
#- name: Run E2e Test
# run: make e2e-test
- name: Run e2e Test
run: make e2e-test
# Upload binaries
- name: Upload Binaries
......@@ -33,6 +36,9 @@ jobs:
build_push_image:
name: Build and Push Images
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
needs: build
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }}
steps:
......@@ -59,14 +65,22 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Declare Branch
- name: Read Secrets
uses: rancher-eio/read-vault-secrets@main
if: ${{ inputs.push == true }}
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name: Login to Docker Hub
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
# rancher/local-path-provisioner image
- name: docker-publish
......@@ -75,7 +89,7 @@ jobs:
with:
context: ./
push: true
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64, linux/arm
tags: rancher/local-path-provisioner:${{ env.branch }}-head
file: package/Dockerfile
......@@ -85,6 +99,6 @@ jobs:
with:
context: ./
push: true
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64, linux/arm
tags: rancher/local-path-provisioner:${{ github.ref_name }}
file: package/Dockerfile
......@@ -51,12 +51,12 @@ var (
EnvConfigMountPath = "CONFIG_MOUNT_PATH"
)
func cmdNotFound(c *cli.Context, command string) {
func cmdNotFound(_ *cli.Context, command string) {
panic(fmt.Errorf("Unrecognized command: %s", command))
}
func onUsageError(c *cli.Context, err error, isSubcommand bool) error {
panic(fmt.Errorf("Usage error, please check your command"))
func onUsageError(_ *cli.Context, err error, _ bool) error {
panic(errors.Wrap(err, "Usage error, please check your command"))
}
func RegisterShutdownChannel(cancelFn context.CancelFunc) {
......
......@@ -3,12 +3,13 @@
FROM alpine
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" != "linux/amd64" ] && [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
RUN if [ "$TARGETPLATFORM" != "linux/amd64" ] && [ "$TARGETPLATFORM" != "linux/arm64" ] && [ "$TARGETPLATFORM" != "linux/arm/v7" ]; then \
echo "Error: Unsupported TARGETPLATFORM: $TARGETPLATFORM" && \
exit 1; \
fi
ENV ARCH ${TARGETPLATFORM#linux/}
ENV ARCH ${ARCH%/v7}
RUN apk update
RUN apk upgrade --no-cache busybox zlib
......
......@@ -317,7 +317,7 @@ func pathFromPattern(pattern string, opts pvController.ProvisionOptions) (string
return buf.String(), nil
}
func (p *LocalPathProvisioner) Provision(ctx context.Context, opts pvController.ProvisionOptions) (*v1.PersistentVolume, pvController.ProvisioningState, error) {
func (p *LocalPathProvisioner) Provision(_ context.Context, opts pvController.ProvisionOptions) (*v1.PersistentVolume, pvController.ProvisioningState, error) {
cfg, err := p.pickConfig(opts.StorageClass.Name)
if err != nil {
return nil, pvController.ProvisioningFinished, err
......@@ -462,7 +462,7 @@ func (p *LocalPathProvisioner) provisionFor(opts pvController.ProvisionOptions,
}, pvController.ProvisioningFinished, nil
}
func (p *LocalPathProvisioner) Delete(ctx context.Context, pv *v1.PersistentVolume) (err error) {
func (p *LocalPathProvisioner) Delete(_ context.Context, pv *v1.PersistentVolume) (err error) {
cfg, err := p.pickConfig(pv.Spec.StorageClassName)
if err != nil {
return err
......
......@@ -12,6 +12,7 @@ fi
LINKFLAGS="-X main.VERSION=$VERSION"
CGO_ENABLED=0 GOARCH=amd64 go build -ldflags "$LINKFLAGS $OTHER_LINKFLAGS" -o bin/local-path-provisioner-amd64
CGO_ENABLED=0 GOARCH=arm64 go build -ldflags "$LINKFLAGS $OTHER_LINKFLAGS" -o bin/local-path-provisioner-arm64
CGO_ENABLED=0 GOARCH=arm go build -ldflags "$LINKFLAGS $OTHER_LINKFLAGS" -o bin/local-path-provisioner-arm
if [ "$CROSS" = "true" ] && [ "$ARCH" = "amd64" ]; then
GOOS=darwin go build -ldflags "$LINKFLAGS" -o bin/local-path-provisioner-darwin
GOOS=windows go build -ldflags "$LINKFLAGS" -o bin/local-path-provisioner-windows
......
......@@ -12,6 +12,7 @@ import (
)
func createCmd(t *testing.T, cmd, kustomizeDir string, envs []string, callback func(*exec.Cmd)) *exec.Cmd {
t.Logf("creating command: %s", cmd)
c := exec.Command("bash", "-c", cmd)
c.Env = append(os.Environ(), envs...)
c.Dir = kustomizeDir
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment