diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..2cac1673 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,16 @@ +# GitHub Action to automate the identification of common misspellings in text files. +# https://github.com/codespell-project/actions-codespell +# https://github.com/codespell-project/codespell +name: codespell +on: [push, pull_request] +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: codespell-project/actions-codespell@master + with: + check_filenames: true + skip: ./.git,./.github/workflows/codespell.yml,.git,*.png,*.jpg,*.svg,*.sum,./vendor,go.sum,./release-tools/prow.sh,./pkg/lib/iscsi/ + ignore_words_list: "lun,targetportal" diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index af13f4b9..c345f89a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -21,7 +21,7 @@ jobs: uses: golangci/golangci-lint-action@v2 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.42 + version: v1.43 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml new file mode 100644 index 00000000..40ed2ce0 --- /dev/null +++ b/.github/workflows/shellcheck.yaml @@ -0,0 +1,29 @@ +name: ShellCheck +on: + push: + tags: + - v* + branches: + - master + - release-* + pull_request: + branches: + - master + - release-* + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + env: + SHELLCHECK_OPTS: -e SC2034 + with: + severity: warning + check_together: 'yes' + disable_matcher: false + ignore_paths: vendor release-tools hack + format: gcc diff --git a/.prow.sh b/.prow.sh index 8f937981..5a230405 100755 --- a/.prow.sh +++ b/.prow.sh @@ -1,3 +1,5 @@ +#! /bin/bash -e + # Copyright 2021 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#! /bin/bash -e # A Prow job can override these defaults, but this shouldn't be necessary. diff --git a/Dockerfile b/Dockerfile index 80ff8a0d..36673fcf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM k8s.gcr.io/build-image/debian-base:bullseye-v1.0.0 +FROM k8s.gcr.io/build-image/debian-base:bullseye-v1.1.0 RUN apt update && apt-mark unhold libcap2 RUN clean-install ca-certificates mount # install updated packages to fix CVE issues -RUN clean-install libssl1.1 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0 libgmp10 +RUN clean-install libssl1.1 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0 libgmp10 bsdutils # Copy iscsiplugin.sh COPY iscsiplugin.sh /iscsiplugin.sh diff --git a/Makefile b/Makefile index f1c890ef..bb6a1198 100644 --- a/Makefile +++ b/Makefile @@ -39,3 +39,11 @@ container: sanity-test: make ./test/sanity/run-test.sh +.PHONY: mod-check +mod-check: + go mod verify && [ "$(shell sha512sum go.mod)" = "`sha512sum go.mod`" ] || ( echo "ERROR: go.mod was modified by 'go mod verify'" && false ) + +.PHONY: clean +clean: + go clean -mod=vendor -r -x + rm -f bin/iscsiplugin diff --git a/iscsiplugin.sh b/iscsiplugin.sh index 54030f5e..2108593d 100755 --- a/iscsiplugin.sh +++ b/iscsiplugin.sh @@ -1,3 +1,5 @@ +#! /bin/bash -x + # Copyright 2021 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#! /bin/bash -x - # Update initiatorname with ${iSCSI_INITIATOR_NAME} and start iscsid, if it is defined if [ -n "${iSCSI_INITIATOR_NAME}" ]; then echo "InitiatorName=${iSCSI_INITIATOR_NAME}" > /etc/iscsi/initiatorname.iscsi @@ -22,4 +22,4 @@ if [ -n "${iSCSI_INITIATOR_NAME}" ]; then fi # Start iscsiplugin -./iscsiplugin $* +./iscsiplugin "$*" diff --git a/pkg/iscsi/driver.go b/pkg/iscsi/driver.go index ff218d52..0e5e0fc6 100644 --- a/pkg/iscsi/driver.go +++ b/pkg/iscsi/driver.go @@ -97,5 +97,4 @@ func (d *driver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapa } d.cscap = csc - } diff --git a/pkg/lib/iscsi/iscsi/multipath.go b/pkg/lib/iscsi/iscsi/multipath.go index 347ae33b..48c7bd30 100644 --- a/pkg/lib/iscsi/iscsi/multipath.go +++ b/pkg/lib/iscsi/iscsi/multipath.go @@ -17,7 +17,7 @@ type path struct { Device string `json:"dev"` } -// ExecWithTimeout execute a command with a timeout and returns an error if timeout is excedeed +// ExecWithTimeout execute a command with a timeout and returns an error if timeout is exceeded func ExecWithTimeout(command string, args []string, timeout time.Duration) ([]byte, error) { debug.Printf("Executing command '%v' with args: '%v'.\n", command, args) @@ -58,7 +58,6 @@ func FlushMultipathDevice(device *Device) error { timeout := 5 * time.Second _, err := execWithTimeout("multipath", []string{"-f", devicePath}, timeout) - if err != nil { if _, e := osStat(devicePath); os.IsNotExist(e) { debug.Printf("Multipath device %v has been removed.\n", devicePath) @@ -71,7 +70,7 @@ func FlushMultipathDevice(device *Device) error { } } - debug.Printf("Finshed flushing multipath device %v.\n", devicePath) + debug.Printf("Finished flushing multipath device %v.\n", devicePath) return nil } diff --git a/release-tools/SIDECAR_RELEASE_PROCESS.md b/release-tools/SIDECAR_RELEASE_PROCESS.md index e4b30e89..1f3ed311 100644 --- a/release-tools/SIDECAR_RELEASE_PROCESS.md +++ b/release-tools/SIDECAR_RELEASE_PROCESS.md @@ -100,6 +100,29 @@ naming convention `-on-`. and [k/k in-tree](https://github.com/kubernetes/kubernetes/tree/HEAD/test/e2e/testing-manifests/storage-csi/hostpath/hostpath) +### Troubleshooting + +#### Image build jobs + +The following jobs are triggered after tagging to produce the corresponding +image(s): +https://k8s-testgrid.appspot.com/sig-storage-image-build + +Clicking on a failed build job opens that job in https://prow.k8s.io. Next to +the job title is a rerun icon (circle with arrow). Clicking it opens a popup +with a "rerun" button that maintainers with enough permissions can use. If in +doubt, ask someone on #sig-release to rerun the job. + +Another way to rerun a job is to search for it in https://prow.k8s.io and click +the rerun icon in the resulting job list: +https://prow.k8s.io/?job=canary-csi-test-push-images + +#### Verify images + +Canary and staged images can be viewed at https://console.cloud.google.com/gcr/images/k8s-staging-sig-storage + +Promoted images can be viewed at https://console.cloud.google.com/gcr/images/k8s-artifacts-prod/us/sig-storage + ## Adding support for a new Kubernetes release 1. Add the new release to `k8s_versions` in diff --git a/release-tools/prow.sh b/release-tools/prow.sh index 819d13db..1f2d0d9c 100755 --- a/release-tools/prow.sh +++ b/release-tools/prow.sh @@ -737,7 +737,7 @@ install_csi_driver () { fi } -# Installs all nessesary snapshotter CRDs +# Installs all necessary snapshotter CRDs install_snapshot_crds() { # Wait until volumesnapshot CRDs are in place. CRD_BASE_DIR="https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION}/client/config/crd" diff --git a/vendor/github.com/kubernetes-csi/csi-lib-iscsi/iscsi/multipath.go b/vendor/github.com/kubernetes-csi/csi-lib-iscsi/iscsi/multipath.go index 347ae33b..48c7bd30 100644 --- a/vendor/github.com/kubernetes-csi/csi-lib-iscsi/iscsi/multipath.go +++ b/vendor/github.com/kubernetes-csi/csi-lib-iscsi/iscsi/multipath.go @@ -17,7 +17,7 @@ type path struct { Device string `json:"dev"` } -// ExecWithTimeout execute a command with a timeout and returns an error if timeout is excedeed +// ExecWithTimeout execute a command with a timeout and returns an error if timeout is exceeded func ExecWithTimeout(command string, args []string, timeout time.Duration) ([]byte, error) { debug.Printf("Executing command '%v' with args: '%v'.\n", command, args) @@ -58,7 +58,6 @@ func FlushMultipathDevice(device *Device) error { timeout := 5 * time.Second _, err := execWithTimeout("multipath", []string{"-f", devicePath}, timeout) - if err != nil { if _, e := osStat(devicePath); os.IsNotExist(e) { debug.Printf("Multipath device %v has been removed.\n", devicePath) @@ -71,7 +70,7 @@ func FlushMultipathDevice(device *Device) error { } } - debug.Printf("Finshed flushing multipath device %v.\n", devicePath) + debug.Printf("Finished flushing multipath device %v.\n", devicePath) return nil }