-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bfaa2fa
Showing
802 changed files
with
315,388 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
### Summary and Scope | ||
|
||
<!--- Pick one below and delete the rest --> | ||
<!--- Add the JIRA (WORD-NUMBER), or use a hyper-link ([WORD-NUMBER](https://jira-pro.its.hpecorp.net:8443/browse/WORD-NUMBER)). --> | ||
|
||
- Fixes: | ||
- Requires: | ||
- Relates to: | ||
|
||
#### Issue Type | ||
|
||
<!--- Delete un-needed bullets --> | ||
|
||
- Bugfix Pull Request | ||
- Docs Pull Request | ||
- RFE Pull Request | ||
|
||
<!--- words; describe what this change is and what it is for. --> | ||
|
||
### Prerequisites | ||
|
||
<!--- An empty check is two brackets with a space inbetween, a checked checkbox is two brackets with an x inbetween --> | ||
<!--- unchecked checkbox: [ ] --> | ||
<!--- checked checkbox: [x] --> | ||
<!--- invalid checkbox: [] --> | ||
|
||
- [ ] I have included documentation in my PR (or it is not required) | ||
- [ ] I tested this on internal system (if yes, please include results or a description of the test) | ||
- [ ] I tested this on a vshasta system (if yes, please include results or a description of the test) | ||
|
||
### Idempotency | ||
|
||
<!--- describe testing done to verify code changes behave in an idempotent manner --> | ||
|
||
### Risks and Mitigations | ||
|
||
<!--- What is less risky, or more risky now - or if your mod fails is there a new risk? --> | ||
<!--- Example: | ||
This introduces some risk since this change also brings in a newer version of X, but otherwise the original bugfix | ||
is resolved and the overall risk of fatal failures is reduced. | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
labels: | ||
- "dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Greetings | ||
|
||
on: [pull_request, issues] | ||
|
||
jobs: | ||
greeting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/first-interaction@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: 'Thanks for opening an issue. Your feedback helps us | ||
make a better product' | ||
pr-message: 'Thank you for contributing!' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cicd: | ||
- .github/* | ||
- .github/**/* | ||
|
||
documentation: | ||
- "**/*.md" | ||
- "**/*.adoc" | ||
- "docs/**/*" | ||
|
||
legal: | ||
- LICENSE | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
# semver tags: | ||
- 'v[12].[0-9]+.[0-9]+' | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
test: | ||
name: Lint and Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.18 | ||
|
||
- name: Lint | ||
run: | | ||
make tools | ||
make lint | ||
- name: Test | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Cray / HPE | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
# | ||
# | ||
# MIT License | ||
# | ||
# (C) Copyright 2022 Hewlett Packard Enterprise Development LP | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a | ||
# copy of this software and associated documentation files (the "Software"), | ||
# to deal in the Software without restriction, including without limitation | ||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
# and/or sell copies of the Software, and to permit persons to whom the | ||
# Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
# OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
# | ||
SHELL := /bin/bash -o pipefail | ||
ifeq ($(VERSION),) | ||
VERSION := $(shell git describe --tags | tr -s '-' '~' | tr -d '^v') | ||
endif | ||
|
||
GO_FILES?=$$(find . -name '*.go' |grep -v vendor) | ||
TAG?=latest | ||
|
||
.GIT_COMMIT=$(shell git rev-parse HEAD) | ||
.GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) | ||
.GIT_COMMIT_AND_BRANCH=$(.GIT_COMMIT)-$(subst /,-,$(.GIT_BRANCH)) | ||
.GIT_VERSION=$(shell git describe --tags 2>/dev/null || echo "$(.GIT_COMMIT)") | ||
.BUILDTIME=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
CHANGELOG_VERSION_ORIG=$(grep -m1 \## CHANGELOG.MD | sed -e "s/\].*\$//" |sed -e "s/^.*\[//") | ||
CHANGELOG_VERSION=$(shell grep -m1 \ \[[0-9]*.[0-9]*.[0-9]*\] CHANGELOG.MD | sed -e "s/\].*$$//" |sed -e "s/^.*\[//") | ||
BUILD_DIR ?= $(PWD)/dist/rpmbuild | ||
ifeq ($(GIT_REPO_NAME),) | ||
GIT_REPO_NAME := $(shell basename $(pwd)) | ||
endif | ||
NAME ?= ${GIT_REPO_NAME} | ||
SPEC_FILE ?= ${SPEC_NAME}.spec | ||
SOURCE_NAME ?= ${SPEC_NAME}-${VERSION} | ||
SOURCE_PATH := ${BUILD_DIR}/SOURCES/${SOURCE_NAME}.tar.bz2 | ||
TEST_OUTPUT_DIR ?= $(CURDIR)/build/results | ||
|
||
# if we're an automated build, use .GIT_COMMIT_AND_BRANCH as-is, else add -dirty | ||
ifneq "$(origin BUILD_NUMBER)" "environment" | ||
ifneq "$(origin GITHUB_WORKSPACE)" "environment" | ||
# not a github build | ||
# assume non-pipeline build | ||
.GIT_COMMIT_AND_BRANCH := $(.GIT_COMMIT_AND_BRANCH)-dirty | ||
endif | ||
endif | ||
|
||
.PHONY: \ | ||
help \ | ||
run \ | ||
help \ | ||
clean \ | ||
clean-artifacts \ | ||
clean-releases \ | ||
test \ | ||
vet \ | ||
lint \ | ||
fmt \ | ||
env \ | ||
build \ | ||
doc \ | ||
version | ||
|
||
all: fmt lint reset build | ||
|
||
rpm: prepare rpm_package_source rpm_build_source rpm_build | ||
|
||
help: | ||
@echo 'Usage: make <OPTIONS> ... <TARGETS>' | ||
@echo '' | ||
@echo 'Available targets are:' | ||
@echo '' | ||
@echo ' run Run csi.' | ||
@echo ' help Show this help screen.' | ||
@echo ' clean Remove binaries, artifacts and releases.' | ||
@echo ' clean-artifacts Remove build artifacts only.' | ||
@echo ' clean-releases Remove releases only.' | ||
@echo ' tools Install tools needed by the project.' | ||
@echo ' test Run unit tests.' | ||
@echo ' vet Run go vet.' | ||
@echo ' lint Run golint.' | ||
@echo ' fmt Run go fmt.' | ||
@echo ' tidy Run go mod tidy.' | ||
@echo ' env Display Go environment.' | ||
@echo ' build Build project for current platform.' | ||
@echo ' doc Start Go documentation server on port 8080.' | ||
@echo ' version Display Go version.' | ||
@echo '' | ||
@echo 'Targets run by default are: fmt, lint, vet, and build.' | ||
@echo '' | ||
|
||
print-%: | ||
@echo $* = $($*) | ||
|
||
prepare: | ||
rm -rf $(BUILD_DIR) | ||
mkdir -p $(BUILD_DIR)/SPECS $(BUILD_DIR)/SOURCES | ||
cp $(SPEC_FILE) $(BUILD_DIR)/SPECS/ | ||
|
||
clean: clean-artifacts clean-releases | ||
go clean -i ./... | ||
rm -vf \ | ||
$(CURDIR)/build/results/coverage/* \ | ||
$(CURDIR)/build/results/unittest/* \ | ||
|
||
clean-artifacts: | ||
rm -Rf artifacts/* | ||
|
||
clean-releases: | ||
rm -Rf releases/* | ||
|
||
clean-all: clean clean-artifacts | ||
|
||
# Run tests | ||
test: build | ||
mkdir -pv $(TEST_OUTPUT_DIR)/unittest $(TEST_OUTPUT_DIR)/coverage | ||
go test ./cmd/... ./internal/... ./pkg/... -v -coverprofile $(TEST_OUTPUT_DIR)/coverage.out -covermode count | tee "$(TEST_OUTPUT_DIR)/testing.out" | ||
cat "$(TEST_OUTPUT_DIR)/testing.out" | go-junit-report | tee "$(TEST_OUTPUT_DIR)/unittest/testing.xml" | tee "$(TEST_OUTPUT_DIR)/unittest/testing.xml" | ||
gocover-cobertura < $(TEST_OUTPUT_DIR)/coverage.out > "$(TEST_OUTPUT_DIR)/coverage/coverage.xml" | ||
go tool cover -html=$(TEST_OUTPUT_DIR)/coverage.out -o "$(TEST_OUTPUT_DIR)/coverage/coverage.html" | ||
|
||
# Run integration tests | ||
integrate: | ||
go test ./cmd/... ./internal/... ./pkg/... -tags=integration -v -coverprofile coverage.out -covermode count | ||
|
||
shcds: | ||
go test ./cmd/... ./internal/... ./pkg/... -tags=integration,shcd -v | ||
|
||
tools: | ||
go install golang.org/x/lint/golint@latest | ||
go install github.com/t-yuki/gocover-cobertura@latest | ||
go install github.com/jstemmer/go-junit-report@latest | ||
|
||
vet: version | ||
go vet -v ./... | ||
|
||
lint: | ||
golint -set_exit_status ./cmd/... | ||
golint -set_exit_status ./internal/... | ||
golint -set_exit_status ./pkg/... | ||
|
||
fmt: | ||
go fmt ./... | ||
|
||
env: | ||
@go env | ||
|
||
# Run against the configured Kubernetes cluster in ~/.kube/configs | ||
run: build | ||
go run ./main.go$(TARGET) $> | ||
|
||
tidy: | ||
go mod tidy | ||
|
||
reset: | ||
rm go.mod go.sum | ||
git checkout go.mod go.sum | ||
|
||
build: fmt | ||
go build -o bin/$(SHORT_NAME) cmd/$(SHORT_NAME)/main.go -ldflags "\ | ||
-X github.com/Cray-HPE/$(NAME)/pkg/version.version=${.GIT_VERSION} \ | ||
-X github.com/Cray-HPE/$(NAME)/pkg/version.buildDate=${.BUILDTIME} \ | ||
-X github.com/Cray-HPE/$(NAME)/pkg/version.sha1ver=${.GIT_COMMIT_AND_BRANCH}" | ||
bin/$(SHORT_NAME) version | ||
|
||
rpm_package_source: | ||
tar --transform 'flags=r;s,^,/$(SOURCE_NAME)/,' --exclude .git --exclude dist -cvjf $(SOURCE_PATH) . | ||
|
||
rpm_build_source: | ||
rpmbuild --nodeps -ts $(SOURCE_PATH) --define "_topdir $(BUILD_DIR)" | ||
|
||
rpm_build: | ||
rpmbuild --nodeps -ba $(SPEC_FILE) --define "_topdir $(BUILD_DIR)" | ||
|
||
doc: | ||
godoc -http=:8080 -index | ||
|
||
version: | ||
@go version | ||
|
||
update-version: build | ||
@echo 'Version = ${CHANGELOG_VERSION}' | ||
echo ${CHANGELOG_VERSION} > .version |
Oops, something went wrong.