Skip to content

Commit

Permalink
Merge pull request #8 from deckhouse/github-actions
Browse files Browse the repository at this point in the history
lint and build with push
  • Loading branch information
31337Ghost authored Sep 6, 2021
2 parents 55b6fd9 + 63b01eb commit 8585c2c
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 111 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI
on:
push:
tags:
- v*
branches:
- master
pull_request:
branches:
- master
env:
REGISTRY: registry-write.deckhouse.io
IMAGE_NAME: yandex-csi-driver/yandex-csi-driver
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# https://github.com/golangci/golangci-lint-action
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42
args: --timeout=5m
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
20 changes: 19 additions & 1 deletion cmd/yandex-csi-driver/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.13-alpine as build
RUN apk add git

WORKDIR /go/src/app
ADD . /go/src/app

ARG OS="linux"
ARG ARCH="amd64"

RUN export VERSION=$(cat VERSION)
RUN export COMMIT=$(git rev-parse HEAD)
RUN export GIT_TREE_STATE=$(git diff --quiet && echo 'clean' || echo 'dirty')

RUN CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -a \
-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}' \
-o /go/bin/yandex-csi-driver \
github.com/deckhouse/yandex-csi-driver/cmd/yandex-csi-driver

FROM alpine:3.10

RUN apk add --no-cache ca-certificates \
Expand All @@ -22,6 +40,6 @@ RUN apk add --no-cache ca-certificates \
blkid \
e2fsprogs-extra

ADD yandex-csi-driver /bin/
COPY --from=build /go/bin/yandex-csi-driver /bin/

ENTRYPOINT ["/bin/yandex-csi-driver"]
41 changes: 0 additions & 41 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.9.10
v0.9.11
2 changes: 1 addition & 1 deletion cmd/yandex-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"os/signal"
"syscall"

"github.com/flant/yandex-csi-driver/driver"
"github.com/deckhouse/yandex-csi-driver/driver"
)

func main() {
Expand Down
5 changes: 2 additions & 3 deletions deploy/1.17/csi-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ spec:
- name: socket-dir
mountPath: /csi
- name: csi-resizer
# https://github.com/flant/external-resizer/tree/faster-workqueue
image: flant/external-resizer:v0.4.0-flant.1
image: quay.io/k8scsi/csi-resizer:v1.1.0
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
Expand All @@ -55,7 +54,7 @@ spec:
- name: socket-dir
mountPath: /csi
- name: csi-controller
image: flant/yandex-csi-plugin:v0.9.7
image: registry.deckhouse.io/yandex-csi-driver/yandex-csi-driver:v0.9.11
args:
- "--address=$(MY_POD_IP):12302"
- "--endpoint=unix:/csi/csi.sock"
Expand Down
2 changes: 1 addition & 1 deletion deploy/1.17/csi-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
- name: csi-node
securityContext:
privileged: true
image: flant/yandex-csi-plugin:v0.9.7
image: registry.deckhouse.io/yandex-csi-driver/yandex-csi-driver:v0.9.11
args:
- "--endpoint=unix:/csi/csi.sock"
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"sync"
"time"

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

ycloud "github.com/yandex-cloud/go-sdk"
"github.com/yandex-cloud/go-sdk/iamkey"
Expand Down
1 change: 1 addition & 0 deletions driver/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func (c *HealthChecker) Check(ctx context.Context) error {
var eg errgroup.Group

for _, check := range c.checks {
check := check
eg.Go(func() error {
return check.Check(ctx)
})
Expand Down
6 changes: 3 additions & 3 deletions driver/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ func (m *mounter) GetStatistics(volumePath string) (volumeStatistics, error) {
}

volStats := volumeStatistics{
availableBytes: int64(statfs.Bavail) * statfs.Bsize,
totalBytes: int64(statfs.Blocks) * statfs.Bsize,
usedBytes: (int64(statfs.Blocks) - int64(statfs.Bfree)) * statfs.Bsize,
availableBytes: int64(statfs.Bavail) * int64(statfs.Bsize),
totalBytes: int64(statfs.Blocks) * int64(statfs.Bsize),
usedBytes: (int64(statfs.Blocks) - int64(statfs.Bfree)) * int64(statfs.Bsize),

availableInodes: int64(statfs.Ffree),
totalInodes: int64(statfs.Files),
Expand Down
4 changes: 1 addition & 3 deletions driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,7 @@ func (d *Driver) nodePublishVolumeForFileSystem(req *csi.NodePublishVolumeReques
target := req.TargetPath

mnt := req.VolumeCapability.GetMount()
for _, flag := range mnt.MountFlags {
mountOptions = append(mountOptions, flag)
}
mountOptions = append(mountOptions, mnt.MountFlags...)

fsType := "ext4"
if mnt.FsType != "" {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/flant/yandex-csi-driver
module github.com/deckhouse/yandex-csi-driver

require (
github.com/container-storage-interface/spec v1.2.0
Expand Down
Loading

0 comments on commit 8585c2c

Please sign in to comment.