Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/release automation #170

Draft
wants to merge 50 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
09480b8
release-v1.2.3 (#2)
abhi16394 Mar 12, 2021
594aaa5
Support for CSI 1.3 (#3)
kumarrprashant2005 Jun 11, 2021
392d0b3
Etcd 3.5 (#4)
kumarrprashant2005 Aug 31, 2021
bc4f569
Support for CSI 1.4 (#5)
kumarrprashant2005 Sep 3, 2021
0819669
Support for CSI 1.5
nitesh3108 Oct 13, 2021
dc33e12
Updated max allowed length for string field NodeID to 256, and for ot…
Oct 14, 2021
e18975a
Merge pull request #6 from dell/spec-1.5.0
bpjain2004 Oct 14, 2021
b18545e
fix issue with injector (#7)
JacobGros Feb 18, 2022
d225512
Go fixes (#8)
JacobGros Apr 11, 2022
437bfc6
Path Limit changes (#10)
meggm May 12, 2022
2bf3d53
max path supported bump (#11)
nitesh3108 May 23, 2022
48ff29a
Set Pathlimit to default maxFieldString if the length is lower (#12)
meggm May 25, 2022
5c7c4d7
gosec G304 resolved
Sakshi-dell May 31, 2022
e4c422b
Merge pull request #13 from dell/go-G304-check-fix
Sakshi-dell May 31, 2022
16278b2
go version and package update (#14)
nitesh3108 Mar 3, 2023
5d1e3d5
ci(linters): added golangci-lint
shanduur-dell Aug 2, 2023
4bab902
CSI 1.6 support
adarsh-dell Sep 15, 2023
8d1ccd5
Fix linting (#19)
tdawe Oct 31, 2023
006f96c
Bump google.golang.org/grpc from 1.43.0 to 1.56.3
dependabot[bot] Oct 31, 2023
d2d8ea6
Bump google.golang.org/grpc from 1.43.0 to 1.56.3
ChristianAtDell Oct 31, 2023
d21363f
Bump golang.org/x/net from 0.7.0 to 0.17.0
dependabot[bot] Oct 31, 2023
10803e3
Bump golang.org/x/net from 0.7.0 to 0.17.0
ChristianAtDell Oct 31, 2023
d7a55c6
Merge branch 'main' into release-1.9.0
adarsh-dell Nov 7, 2023
82dd91e
Update go.sum
adarsh-dell Nov 7, 2023
1340f73
Merge pull request #16 from dell/release-1.9.0
adarsh-dell Nov 9, 2023
47f1eb8
Update go version to 1.22
nitesh3108 Feb 21, 2024
bbe1412
Merge pull request #20 from dell/go-version-bumpup-1.22
shefali-malhotra Feb 22, 2024
abde0ea
Merge pull request #15 from dell/ci-add-golangci-lint
jooseppi-luna Apr 17, 2024
45994a3
update github workflow
chimanjain Apr 29, 2024
e923f19
gofumpt fix
chimanjain Apr 29, 2024
8114721
golang-ci lint fixes
chimanjain Apr 29, 2024
f3cb1d2
more fixes and added exceptions
chimanjain Apr 29, 2024
8744be2
minor fix
chimanjain Apr 29, 2024
8f68925
Merge pull request #23 from dell/upd-workflow
chimanjain Apr 30, 2024
b88fa96
Bump golang.org/x/net from 0.17.0 to 0.23.0
dependabot[bot] Apr 30, 2024
fd523dc
Merge pull request #22 from dell/dependabot/go_modules/golang.org/x/n…
chimanjain Apr 30, 2024
16d29ae
Bump google.golang.org/protobuf from 1.30.0 to 1.33.0
dependabot[bot] Apr 30, 2024
5e265bf
remove deprecated functions
chimanjain Apr 30, 2024
e5a8fdc
Merge pull request #21 from dell/dependabot/go_modules/google.golang.…
chimanjain Apr 30, 2024
060a533
remove deprecated modules and functions
chimanjain Jun 13, 2024
554b1fc
Merge pull request #24 from dell/remove-deprecated-github.com/golang/…
chimanjain Jun 13, 2024
df682bd
Bump google.golang.org/grpc from 1.64.0 to 1.64.1
dependabot[bot] Jul 9, 2024
01d8728
Merge pull request #25 from dell/dependabot/go_modules/google.golang.…
shefali-malhotra Jul 10, 2024
f551e35
Add go version update worklow
falfaroc Oct 4, 2024
c2f21a1
Address lint errors
falfaroc Oct 7, 2024
0bc0fc5
Merge pull request #26 from dell/add-go-version-workflow
falfaroc Oct 8, 2024
a103523
Update go version to 1.23
csm-release[bot] Oct 21, 2024
3843d35
Update go.mod
shaynafinocchiaro Oct 21, 2024
d170e3e
Merge pull request #28 from dell/go-1.23
donatwork Oct 21, 2024
57c62ef
Added action for releasing the lib
harishp8889 Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Description
A few sentences describing the overall goals of the pull request's commits.

# GitHub Issues
List the GitHub issues impacted by this PR:

| GitHub Issue # |
| -------------- |
| |

# Checklist:

- [ ] I have performed a self-review of my own code to ensure there are no formatting, vetting, linting, or security issues
- [ ] I have verified that new and existing unit tests pass locally with my changes
- [ ] I have not allowed coverage numbers to degenerate
- [ ] I have maintained at least 90% code coverage
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] Backward compatibility is not broken

# How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B
38 changes: 38 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Workflow
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
code-check:
name: Check Go formatting, linting, vetting
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Run the formatter, linter, and vetter
uses: dell/common-github-actions/go-code-formatter-linter-vetter@main
with:
directories: ./...
go_security_scan:
name: Go security
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Run Go Security
uses: securego/gosec@master
with:
args: "-exclude G307 ./..."
malware_security_scan:
name: Malware Scanner
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Run malware scan
uses: dell/common-github-actions/malware-scanner@main
with:
directories: .
options: -ri
22 changes: 22 additions & 0 deletions .github/workflows/go-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0

# Reusable workflow to perform go version update on Golang based projects
name: Go Version Update

on:
workflow_dispatch:
repository_dispatch:
types: [go-update-workflow]

jobs:
# go version update
go-version-update:
uses: dell/common-github-actions/.github/workflows/go-version-workflow.yaml@main
name: Go Version Update
secrets: inherit
30 changes: 30 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: linters

on:
push:
branches: [main]
pull_request:
branches: ["**"]

permissions:
contents: read

jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: false
- name: Checkout the code
uses: actions/checkout@v4
- name: Vendor packages
run: |
go mod vendor
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
version: latest
skip-cache: true
15 changes: 15 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release GoCSI
# Invocable as a reusable workflow
# Can be manually triggered
on:
workflow_call:
workflow_dispatch:
inputs:
version:
description: 'Version to release (major, minor, patch)'
required: true
default: 'none'
jobs:
csm-release:
uses: dell/common-github-actions/.github/workflows/csm-release-libs.yaml@main
name: Release Go Client Libraries
33 changes: 33 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
run:
timeout: 20m
issue-exit-code: 0 # we will change this later
tests: true
skip-dirs-use-default: true
modules-download-mode: readonly

issues:
max-issues-per-linter: 0
max-same-issues: 0
new: false
exclude:
- "parameter 'args' seems to be unused, consider removing or renaming it as _"
- "parameter 'cmd' seems to be unused, consider removing or renaming it as _"

output:
print-linter-name: true
sort-results: true
uniq-by-line: false
print-issued-lines: true

linters:
disable-all: true
fast: false
enable:
# A stricter replacement for gofmt.
- gofumpt
# Inspects source code for security problems.
- gosec
# Check for correctness of programs.
- govet
# Drop-in replacement of golint.
- revive
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The quickest way to use the bleeding edge copy of GoCSI or one of its
components is with the following command:

```shell
$ go get -u github.com/rexray/gocsi
$ go get -u github.com/dell/gocsi
```

## Running the tests
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ endif
GINKGO_RUN_OPTS := -ginkgo.slowSpecThreshold=$(GINKGO_SECS) -ginkgo.randomizeAllSpecs

ETCD := ./etcd
ETCD_VER=v3.5.0
DOWNLOAD_URL=https://storage.googleapis.com/etcd
$(ETCD):
go get -u -d github.com/coreos/etcd
go build -o $@ github.com/coreos/etcd
curl -L $(DOWNLOAD_URL)/$(ETCD_VER)/etcd-$(ETCD_VER)-linux-amd64.tar.gz -o /tmp/etcd-$(ETCD_VER)-linux-amd64.tar.gz
tar xzvf /tmp/etcd-$(ETCD_VER)-linux-amd64.tar.gz -C . --strip-components=1
rm -f /tmp/etcd-$(ETCD_VER)-linux-amd64.tar.gz

# The test recipe executes the Go tests with the Ginkgo test
# runner. This is the reason for the boolean OR condition
Expand Down
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# GoCSI

The Container Storage Interface
([CSI](https://github.com/container-storage-interface/spec))
is an industry standard specification for creating storage plug-ins
Expand All @@ -12,19 +13,22 @@ of CSI storage plug-ins (SP):
| [mock](./mock) | Mock CSI SP |

## Quick Start

The following example illustrates using Docker in combination with the
GoCSI SP bootstrapper to create a new CSI SP from scratch, serve it on a
UNIX socket, and then use the GoCSI command line client [`csc`](./csc/) to
invoke the `GetPluginInfo` RPC:

```shell
$ docker run -it golang:latest sh -c \
"go get github.com/rexray/gocsi && \
make -C src/github.com/rexray/gocsi csi-sp"
"go get github.com/dell/gocsi && \
make -C src/github.com/dell/gocsi csi-sp"
```

<a name="bootstrapper"></a>

## Bootstrapping a Storage Plug-in

The root of the GoCSI project enables storage administrators and developers
alike to bootstrap a CSI SP:

Expand All @@ -34,30 +38,31 @@ usage: ./gocsi.sh GO_IMPORT_PATH
```

### Bootstrap Example

The GoCSI [Mock SP](./mock) illustrates the features and configuration options
available via the bootstrapping method. The following example demonstrates
creating a new SP at the Go import path `github.com/rexray/csi-sp`:
creating a new SP at the Go import path `github.com/dell/csi-sp`:

```shell
$ ./gocsi.sh github.com/rexray/csi-sp
$ ./gocsi.sh github.com/dell/csi-sp
creating project directories:
/home/akutz/go/src/github.com/rexray/csi-sp
/home/akutz/go/src/github.com/rexray/csi-sp/provider
/home/akutz/go/src/github.com/rexray/csi-sp/service
/home/akutz/go/src/github.com/dell/csi-sp
/home/akutz/go/src/github.com/dell/csi-sp/provider
/home/akutz/go/src/github.com/dell/csi-sp/service
creating project files:
/home/akutz/go/src/github.com/rexray/csi-sp/main.go
/home/akutz/go/src/github.com/rexray/csi-sp/provider/provider.go
/home/akutz/go/src/github.com/rexray/csi-sp/service/service.go
/home/akutz/go/src/github.com/rexray/csi-sp/service/controller.go
/home/akutz/go/src/github.com/rexray/csi-sp/service/identity.go
/home/akutz/go/src/github.com/rexray/csi-sp/service/node.go
/home/akutz/go/src/github.com/dell/csi-sp/main.go
/home/akutz/go/src/github.com/dell/csi-sp/provider/provider.go
/home/akutz/go/src/github.com/dell/csi-sp/service/service.go
/home/akutz/go/src/github.com/dell/csi-sp/service/controller.go
/home/akutz/go/src/github.com/dell/csi-sp/service/identity.go
/home/akutz/go/src/github.com/dell/csi-sp/service/node.go
use golang/dep? Enter yes (default) or no and press [ENTER]:
downloading golang/[email protected]
executing dep init
building csi-sp:
success!
example: CSI_ENDPOINT=csi.sock \
/home/akutz/go/src/github.com/rexray/csi-sp/csi-sp
/home/akutz/go/src/github.com/dell/csi-sp/csi-sp
```

The new SP adheres to the following structure:
Expand All @@ -78,6 +83,7 @@ The new SP adheres to the following structure:
```

### Provider

The `provider` package leverages GoCSI to construct an SP from the CSI
services defined in `service` package. The file `provider.go` may be
modified to:
Expand All @@ -88,19 +94,22 @@ Please see the Mock SP's [`provider.go`](./mock/provider/provider.go) file
for a more complete example.

### Service

The `service` package is where the business logic occurs. The files `controller.go`,
`identity.go`, and `node.go` each correspond to their eponymous CSI services. A
developer creating a new CSI SP with GoCSI will work mostly in these files. Each
of the files have a complete skeleton implementation for their respective service's
remote procedure calls (RPC).

### Main

The root, or `main`, package leverages GoCSI to launch the SP as a stand-alone
server process. The only requirement is that the environment variable `CSI_ENDPOINT`
must be set, otherwise a help screen is emitted that lists all of the SP's available
configuration options (environment variables).

## Configuration

All CSI SPs created using this package are able to leverage the following
environment variables:

Expand Down
22 changes: 12 additions & 10 deletions context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ var (
ctxOSSetenvKey = interface{}("os.Setenev")
)

type lookupEnvFunc func(string) (string, bool)
type setenvFunc func(string, string) error
type (
lookupEnvFunc func(string) (string, bool)
setenvFunc func(string, string) error
)

// GetRequestID inspects the context for gRPC metadata and returns
// its request ID if available.
Expand Down Expand Up @@ -80,16 +82,16 @@ func WithSetenv(ctx context.Context, f setenvFunc) context.Context {

// LookupEnv returns the value of the provided environment variable by:
//
// 1. Inspecting the context for a key "os.Environ" with a string
// slice value. If such a key and value exist then the string slice
// is searched for the specified key and if found its value is returned.
// 1. Inspecting the context for a key "os.Environ" with a string
// slice value. If such a key and value exist then the string slice
// is searched for the specified key and if found its value is returned.
//
// 2. Inspecting the context for a key "os.LookupEnv" with a value of
// func(string) (string, bool). If such a key and value exist then the
// function is used to attempt to discover the key's value. If the
// key and value are found they are returned.
// 2. Inspecting the context for a key "os.LookupEnv" with a value of
// func(string) (string, bool). If such a key and value exist then the
// function is used to attempt to discover the key's value. If the
// key and value are found they are returned.
//
// 3. Returning the result of os.LookupEnv.
// 3. Returning the result of os.LookupEnv.
func LookupEnv(ctx context.Context, key string) (string, bool) {
if s, ok := ctx.Value(ctxOSEnviron).([]string); ok {
for _, v := range s {
Expand Down
2 changes: 1 addition & 1 deletion csc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Use "csc -h,--help" for more information
## Installation

```bash
$ GO111MODULE=off go get -u github.com/rexray/gocsi/csc
$ GO111MODULE=off go get -u github.com/dell/gocsi/csc
```
1 change: 0 additions & 1 deletion csc/cmd/controller_create_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ CREATING MULTIPLE SNAPSHOTS
`,
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {

req := csi.CreateSnapshotRequest{
SourceVolumeId: createSnapshot.sourceVol,
Parameters: createSnapshot.params.data,
Expand Down
Loading