Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
phlogistonjohn committed Nov 29, 2023
2 parents 9d55e1c + 993a5ee commit d173ed0
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: oldstable
- uses: actions/checkout@v3
- name: Build
run: make
Expand All @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: oldstable
- uses: actions/checkout@v3
- name: Install revive
run: go install github.com/mgechev/revive@latest
Expand All @@ -46,7 +46,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: oldstable
- uses: actions/checkout@v3
- name: run the tests
run: make test
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: oldstable
- name: Install k3d
run: curl -L --silent --fail "https://raw.githubusercontent.com/rancher/k3d/main/install.sh" | bash
# The TAG env var can interfere with the k3d install script.
Expand Down
10 changes: 9 additions & 1 deletion .gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ignore-merge-commits=true
# Enable debug mode (prints more output). Disabled by default.
# debug=true

# Enable search regex and remove warning message.
regex-style-search=true

# Enable community contributed rules
# See http://jorisroovers.github.io/gitlint/contrib_rules for details
# contrib=contrib-body-requires-signed-off-by
Expand Down Expand Up @@ -106,11 +109,16 @@ regex=^.*
# Use 'all' to ignore all rules
# ignore=T1,body-min-length

# [ignore-body-lines]
[ignore-body-lines]
# Ignore certain lines in a commit body that match a regex.
# E.g. Ignore all lines that start with 'Co-Authored-By'
# regex=^Co-Authored-By

# ignore lines that are "footnotes", that start like `[1]: ` or `[2]: ` and so on
# this will make it easy to put long urls in commit messages without
# triggering gitlint body rules
regex=^\[[0-9]+\]:? +

# This is a contrib rule - a community contributed rule. These are disabled by default.
# You need to explicitly enable them one-by-one by adding them to the "contrib" option
# under [general] section above.
Expand Down
2 changes: 0 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ linters:
enable:
- asciicheck
# - deadcode
- depguard
- dupl
- errcheck
- exhaustive
Expand Down Expand Up @@ -37,7 +36,6 @@ linters:
- unconvert
# - unparam
- unused
- varcheck
- whitespace
linters-settings:
funlen:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM docker.io/golang:1.18 as builder
FROM docker.io/golang:1.20 as builder
ARG GIT_VERSION="(unset)"
ARG COMMIT_ID="(unset)"
ARG ARCH=""
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ bundle-build:
@false
# See vcs history for how this could be restored or adapted in the future.

.PHONY: check check-revive check-golangci-lint check-format check-yaml check-gosec
.PHONY: check check-revive check-golangci-lint check-format check-yaml check-gosec check-dockerfile-go-version

check: check-revive check-golangci-lint check-format vet check-yaml check-gosec
check: check-revive check-golangci-lint check-format vet check-yaml check-gosec check-dockerfile-go-version

check-format:
! $(GOFMT_CMD) $(CHECK_GOFMT_FLAGS) . | sed 's,^,formatting error: ,' | grep 'go$$'
Expand All @@ -227,6 +227,10 @@ check-yaml:
check-gosec: gosec
$(GOSEC) -quiet -exclude=G101 -fmt json ./...

check-dockerfile-go-version:
# use go-version-check.sh --show to list vaild golang builder images
$(CURDIR)/hack/go-version-check.sh --check

check-gitlint: gitlint
$(GITLINT) -C .gitlint --commits origin/master.. lint

Expand Down
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resources:
- bases/samba-operator.samba.org_smbsecurityconfigs.yaml
- bases/samba-operator.samba.org_smbcommonconfigs.yaml
# +kubebuilder:scaffold:crdkustomizeresource
patchesStrategicMerge:
patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_smbshares.yaml
Expand Down
4 changes: 2 additions & 2 deletions config/manager-full/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../manager
patchesStrategicMerge:
patches:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- auth_proxy_patch.yaml
- path: auth_proxy_patch.yaml

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resources.
Development effort takes place using Linux environment and requires at
minimum:

1. [Go 1.18](https://golang.org/dl/) installed
1. [Go 1.19](https://golang.org/dl/) installed
2. [GitHub](https://github.com/) account
3. Development tools: git, make, and podman or docker
4. Testing: [minikube](https://minikube.sigs.k8s.io)
Expand Down
2 changes: 1 addition & 1 deletion docs/developers-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Build from source

The top-level [Makefile](../Makefile) is the entry point for various build
commands. The minimal required Go version is 1.18. A developer can verify the
commands. The minimal required Go version is 1.19. A developer can verify the
build environment by running:

```bash
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/samba-in-kubernetes/samba-operator

go 1.18
go 1.19

require (
github.com/go-logr/logr v1.2.3
Expand Down Expand Up @@ -59,11 +59,11 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -689,12 +689,12 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -703,8 +703,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
113 changes: 113 additions & 0 deletions hack/go-version-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/bash
#
# List or check that the golang version embedded in files (specifically our
# Dockerfile) is using a supported version of Go.
# Run with --show to list the images the script thinks are current.
# Run with --check (the default) to verify the Dockerfile contains a current
# image & version tag.
#

set -e
SCRIPT_DIR="$(readlink -f "$(dirname "${0}")")"
PROJECT_DIR="$(readlink -f "${SCRIPT_DIR}/..")"
WORKDIR="$(mktemp -d)"
CONTAINER_FILES=("${PROJECT_DIR}/Dockerfile")
GOVERSURL='https://go.dev/dl/?mode=json'
ACTION=check


fetch_versions() {
local url="$1"
local out="$2"
if [ -f "${out}" ]; then
return
fi
echo "Fetching Go versions..." >&2
curl --fail -sL -o "${out}" "${url}"
}

extract_versions() {
local jsonfile="$1"
jq -r '.[].version' < "${jsonfile}" | \
cut -d. -f1,2 | sort -u | sed -e 's,^go,,'
}

to_images() {
for a in "$@"; do
echo "docker.io/golang:${a}"
done
}

cleanup() {
# only used in trap, ignoe unreachable error
# shellcheck disable=SC2317
rm -rf "${WORKDIR}"
}
trap cleanup EXIT


opts=$(getopt --name "$0" \
-o "csf:" -l "check,show,file:,url:,versionsfile:" -- "$@")
eval set -- "$opts"

cli_cfiles=()
while true ; do
case "$1" in
-c|--check)
ACTION=check
shift
;;
-s|--show)
ACTION=show
shift
;;
-f|--file)
cli_cfiles+=("$2")
shift 2
;;
--url)
GOVERSURL="$2"
shift 2
;;
--versionsfile)
GOVERSIONSFILE="$2"
shift 2
;;
--)
shift
break
;;
*)
echo "unexpected option: $1" >&2
exit 2
;;
esac
done

if [ "${#cli_cfiles}" -gt 0 ]; then
CONTAINER_FILES=("${cli_cfiles[@]}")
fi

GV="${GOVERSIONSFILE:-${WORKDIR}/go-versions.json}"
fetch_versions "${GOVERSURL}" "${GV}"
mapfile -t go_major_vers < <(extract_versions "${GV}")

echo "Found Go versions:" "${go_major_vers[@]}" >&2
if [ "${ACTION}" = show ]; then
to_images "${go_major_vers[@]}"
exit 1
fi

mapfile -t valid_images < <(to_images "${go_major_vers[@]}")
errors=0
for cf in "${CONTAINER_FILES[@]}"; do
echo "Checking $cf ..." >&2
if grep -q -e "${valid_images[0]}" -e "${valid_images[1]}" "${cf}" ; then
echo "${cf}: OK" >&2
else
echo "${cf}: no current golang image found" >&2
errors=1
fi
done

exit "${errors}"
2 changes: 1 addition & 1 deletion hack/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _install_revive() {
}

_install_golangci_lint() {
_install_tool github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
_install_tool github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3
}

_install_yq() {
Expand Down
2 changes: 1 addition & 1 deletion tests/centosci/sink-clustered-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup_minikube

deploy_rook

image_pull "${CI_IMG_REGISTRY}" "docker.io" "golang:1.18"
image_pull "${CI_IMG_REGISTRY}" "docker.io" "golang:1.20"

# Build and push operator image to local CI registry
IMG="${CI_IMG_OP}" make image-build
Expand Down

0 comments on commit d173ed0

Please sign in to comment.