Skip to content

Commit 8585c2c

Browse files
authored
Merge pull request #8 from deckhouse/github-actions
lint and build with push
2 parents 55b6fd9 + 63b01eb commit 8585c2c

File tree

14 files changed

+88
-111
lines changed

14 files changed

+88
-111
lines changed

.github/workflows/ci.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
env:
12+
REGISTRY: registry-write.deckhouse.io
13+
IMAGE_NAME: yandex-csi-driver/yandex-csi-driver
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
# https://github.com/golangci/golangci-lint-action
20+
- name: golangci-lint
21+
uses: golangci/golangci-lint-action@v2
22+
with:
23+
version: v1.42
24+
args: --timeout=5m
25+
build:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
steps:
31+
- uses: actions/checkout@v2
32+
# Login against a Docker registry except on PR
33+
# https://github.com/docker/login-action
34+
- name: Log into registry ${{ env.REGISTRY }}
35+
if: github.event_name != 'pull_request'
36+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }}
40+
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }}
41+
# Extract metadata (tags, labels) for Docker
42+
# https://github.com/docker/metadata-action
43+
- name: Extract Docker metadata
44+
id: meta
45+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
# Build and push Docker image with Buildx (don't push on PR)
49+
# https://github.com/docker/build-push-action
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
52+
with:
53+
context: .
54+
push: ${{ github.event_name != 'pull_request' }}
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

cmd/yandex-csi-driver/Dockerfile renamed to Dockerfile

+19-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
FROM golang:1.13-alpine as build
17+
RUN apk add git
18+
19+
WORKDIR /go/src/app
20+
ADD . /go/src/app
21+
22+
ARG OS="linux"
23+
ARG ARCH="amd64"
24+
25+
RUN export VERSION=$(cat VERSION)
26+
RUN export COMMIT=$(git rev-parse HEAD)
27+
RUN export GIT_TREE_STATE=$(git diff --quiet && echo 'clean' || echo 'dirty')
28+
29+
RUN CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -a \
30+
-ldflags '-X github.com/deckhouse/yandex-csi-driver/driver.version=${VERSION} -X github.com/deckhouse/yandex-csi-driver/driver.commit=${COMMIT} -X github.com/deckhouse/yandex-csi-driver/driver.gitTreeState=${GIT_TREE_STATE}' \
31+
-o /go/bin/yandex-csi-driver \
32+
github.com/deckhouse/yandex-csi-driver/cmd/yandex-csi-driver
33+
1634
FROM alpine:3.10
1735

1836
RUN apk add --no-cache ca-certificates \
@@ -22,6 +40,6 @@ RUN apk add --no-cache ca-certificates \
2240
blkid \
2341
e2fsprogs-extra
2442

25-
ADD yandex-csi-driver /bin/
43+
COPY --from=build /go/bin/yandex-csi-driver /bin/
2644

2745
ENTRYPOINT ["/bin/yandex-csi-driver"]

Makefile

-41
This file was deleted.

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.9.10
1+
v0.9.11

cmd/yandex-csi-driver/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"os/signal"
2727
"syscall"
2828

29-
"github.com/flant/yandex-csi-driver/driver"
29+
"github.com/deckhouse/yandex-csi-driver/driver"
3030
)
3131

3232
func main() {

deploy/1.17/csi-controller.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ spec:
3838
- name: socket-dir
3939
mountPath: /csi
4040
- name: csi-resizer
41-
# https://github.com/flant/external-resizer/tree/faster-workqueue
42-
image: flant/external-resizer:v0.4.0-flant.1
41+
image: quay.io/k8scsi/csi-resizer:v1.1.0
4342
args:
4443
- "--v=5"
4544
- "--csi-address=/csi/csi.sock"
@@ -55,7 +54,7 @@ spec:
5554
- name: socket-dir
5655
mountPath: /csi
5756
- name: csi-controller
58-
image: flant/yandex-csi-plugin:v0.9.7
57+
image: registry.deckhouse.io/yandex-csi-driver/yandex-csi-driver:v0.9.11
5958
args:
6059
- "--address=$(MY_POD_IP):12302"
6160
- "--endpoint=unix:/csi/csi.sock"

deploy/1.17/csi-node.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ spec:
3737
- name: csi-node
3838
securityContext:
3939
privileged: true
40-
image: flant/yandex-csi-plugin:v0.9.7
40+
image: registry.deckhouse.io/yandex-csi-driver/yandex-csi-driver:v0.9.11
4141
args:
4242
- "--endpoint=unix:/csi/csi.sock"
4343
volumeMounts:

driver/controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727

2828
"github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
2929

30-
"github.com/flant/yandex-csi-driver/ychelpers"
30+
"github.com/deckhouse/yandex-csi-driver/ychelpers"
3131

3232
"github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1"
3333

driver/driver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"sync"
3131
"time"
3232

33-
"github.com/flant/yandex-csi-driver/ychelpers"
33+
"github.com/deckhouse/yandex-csi-driver/ychelpers"
3434

3535
ycloud "github.com/yandex-cloud/go-sdk"
3636
"github.com/yandex-cloud/go-sdk/iamkey"

driver/health.go

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func (c *HealthChecker) Check(ctx context.Context) error {
5353
var eg errgroup.Group
5454

5555
for _, check := range c.checks {
56+
check := check
5657
eg.Go(func() error {
5758
return check.Check(ctx)
5859
})

driver/mounter.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ func (m *mounter) GetStatistics(volumePath string) (volumeStatistics, error) {
344344
}
345345

346346
volStats := volumeStatistics{
347-
availableBytes: int64(statfs.Bavail) * statfs.Bsize,
348-
totalBytes: int64(statfs.Blocks) * statfs.Bsize,
349-
usedBytes: (int64(statfs.Blocks) - int64(statfs.Bfree)) * statfs.Bsize,
347+
availableBytes: int64(statfs.Bavail) * int64(statfs.Bsize),
348+
totalBytes: int64(statfs.Blocks) * int64(statfs.Bsize),
349+
usedBytes: (int64(statfs.Blocks) - int64(statfs.Bfree)) * int64(statfs.Bsize),
350350

351351
availableInodes: int64(statfs.Ffree),
352352
totalInodes: int64(statfs.Files),

driver/node.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,7 @@ func (d *Driver) nodePublishVolumeForFileSystem(req *csi.NodePublishVolumeReques
461461
target := req.TargetPath
462462

463463
mnt := req.VolumeCapability.GetMount()
464-
for _, flag := range mnt.MountFlags {
465-
mountOptions = append(mountOptions, flag)
466-
}
464+
mountOptions = append(mountOptions, mnt.MountFlags...)
467465

468466
fsType := "ext4"
469467
if mnt.FsType != "" {

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/flant/yandex-csi-driver
1+
module github.com/deckhouse/yandex-csi-driver
22

33
require (
44
github.com/container-storage-interface/spec v1.2.0

0 commit comments

Comments
 (0)