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

Add files required for downstream builds #2

Merged
merged 33 commits into from Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c9b8c3c
make paths aligned with kubernetes-sigs
arahamad Aug 2, 2021
8f59cda
added approver
arahamad Aug 2, 2021
22c8dea
To get coverage badge integrate with goveralls
ambiknai Aug 6, 2021
7f93d1e
Fix the import path
ambiknai Aug 6, 2021
fde425a
Merge pull request #22 from ambiknai/goveraals
k8s-ci-robot Aug 9, 2021
869a43a
Merge pull request #21 from arahamad/master
k8s-ci-robot Aug 9, 2021
7620eab
update coverage badge
ambiknai Aug 9, 2021
2187e94
Merge pull request #23 from ambiknai/readmebadge
k8s-ci-robot Aug 10, 2021
41f3366
Edit build status badge
ambiknai Aug 17, 2021
9deefc7
Fix makefile issues
ambiknai Aug 17, 2021
91f148f
Create workflow.yaml
ambiknai Aug 17, 2021
4565991
Delete workflow.yaml
ambiknai Aug 17, 2021
7da26b4
Create coverage.yml
ambiknai Aug 17, 2021
956e7bd
coverage using github actions
ambiknai Aug 17, 2021
ba8cf6c
Merge pull request #24 from ambiknai/owners
k8s-ci-robot Aug 17, 2021
911d806
use latest go lang
ambiknai Aug 18, 2021
2a8c81d
Merge pull request #26 from ambiknai/githubactions
k8s-ci-robot Aug 18, 2021
b99b16c
Fix github action issue
ambiknai Aug 18, 2021
87eb9b7
Merge pull request #28 from ambiknai/master
k8s-ci-robot Aug 18, 2021
eb8c7ce
Makefile support to push images to staging gcr registry
ambiknai Sep 8, 2021
931f6a5
Add CONTRIBUTING.md
ambiknai Sep 9, 2021
f8a2939
Review comments
ambiknai Sep 15, 2021
2f3d8e8
Review commets
ambiknai Sep 15, 2021
be0900a
Merge pull request #31 from ambiknai/makefilechange
k8s-ci-robot Sep 16, 2021
2ed1916
Merge pull request #32 from ambiknai/contrib
k8s-ci-robot Sep 17, 2021
0a9e713
Fix Makefile to push manifests
ambiknai Sep 17, 2021
80dcf60
Merge pull request #34 from ambiknai/fixmakefile
k8s-ci-robot Sep 17, 2021
bded7e3
Add gcloud tag
ambiknai Sep 17, 2021
0ca75a7
pull and tag manifest image
ambiknai Sep 17, 2021
9761277
Merge pull request #35 from ambiknai/gcloudcli
k8s-ci-robot Sep 18, 2021
53f84d0
push image to release tag
ambiknai Sep 20, 2021
a6338a6
Merge pull request #36 from ambiknai/pushmaster
arahamad-zz Sep 21, 2021
97d640c
UPSTREAM: <carry>: add OWNERS, Dockerfile, .ci-operator.yaml
dobsonj Sep 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .ci-operator.yaml
@@ -0,0 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: golang-1.16
35 changes: 35 additions & 0 deletions .github/workflows/coverage.yml
@@ -0,0 +1,35 @@
name: Quality
on: [push, pull_request]
jobs:
test:
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
name: Test with Coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.16'
- name: Check out code
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
- name: Install dependencies
run: |
go mod download
- name: Run Unit tests
run: |
go test $(go list ./... | grep -v /vendor/ | grep -v /cmd | grep -v /tests) -race -covermode atomic -coverprofile=covprofile ./...
- name: Install goveralls
env:
GOPATH: ${{ github.workspace }}
run: go install github.com/mattn/goveralls@latest
- name: Send coverage
run: $GOPATH/bin/goveralls -coverprofile=covprofile -service=github
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: ${{ github.workspace }}
40 changes: 10 additions & 30 deletions .travis.yml
@@ -1,37 +1,17 @@
language: go
go_import_path: github.com/kubernetes-sigs/ibm-vpc-block-csi-driver
dist: xenial
env:
global:
- GO111MODULE=on

go:
- "1.16"
- tip

group: bluezone

matrix:
fast_finish: true
allow_failures:
- go: tip

cache:
bundler: true

sudo: true
- "1.16.x"

before_install:
- sudo apt-get install bc

before_script:
- make deps
- go get github.com/pierrre/gotestcover
- go install github.com/mattn/goveralls@latest

script:
- make dofmt
- travis_wait 300 make test
- make ut-coverage && touch "Passing" || touch "Failed"


after_success:
- "./scripts/calculateCoverage.sh"
- "./scripts/publishCoverage.sh"

after_failure:
- "./scripts/handleFailure.sh"
- make
- go test -covermode=count -coverprofile=profile.cov ./pkg/...
- $GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,14 @@
# Contributing guidelines

## Sign the CLA

Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests. Please see https://git.k8s.io/community/CLA.md for more info

### Contributing A Patch

1. Submit an issue describing your proposed change to the repo in question.
1. The [repo owners](OWNERS) will respond to your issue promptly.
1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above).
1. Fork the desired repo, develop and test your code changes.
1. Submit a pull request.

6 changes: 3 additions & 3 deletions Dockerfile.builder
@@ -1,7 +1,7 @@
FROM golang:1.16
FROM golang:1.16.7

WORKDIR /go/src/github.com/IBM/ibm-vpc-block-csi-driver
ADD . /go/src/github.com/IBM/ibm-vpc-block-csi-driver
WORKDIR /go/src/github.com/kubernetes-sigs/ibm-vpc-block-csi-driver
ADD . /go/src/github.com/kubernetes-sigs/ibm-vpc-block-csi-driver

ARG TAG
ARG OS
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile.openshift
@@ -0,0 +1,12 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.16-openshift-4.10 AS builder
WORKDIR /go/src/github.com/openshift/ibm-vpc-block-csi-driver
COPY . .
RUN make build

FROM registry.ci.openshift.org/ocp/4.10:base
COPY --from=builder /go/bin/ibm-vpc-block-csi-driver /bin/ibm-vpc-block-csi-driver
RUN yum install -y util-linux nfs-utils e2fsprogs xfsprogs ca-certificates && yum clean all && rm -rf /var/cache/yum

LABEL description="IBM VPC Block CSI Driver"

ENTRYPOINT ["/bin/ibm-vpc-block-csi-driver"]
1 change: 0 additions & 1 deletion MAINTAINERS.md
@@ -1,4 +1,3 @@
## MAINTAINERS

Arashad Ahamad - arahamad@in.ibm.com
Meghna Singh - meghna.singh1@ibm.com
119 changes: 85 additions & 34 deletions Makefile
Expand Up @@ -16,21 +16,36 @@

EXE_DRIVER_NAME=ibm-vpc-block-csi-driver
DRIVER_NAME=vpcBlockDriver
IMAGE = contsto2/${EXE_DRIVER_NAME}
GOPACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /cmd | grep -v /tests)
VERSION := latest
GIT_COMMIT_SHA="$(shell git rev-parse HEAD 2>/dev/null)"
GIT_REMOTE_URL="$(shell git config --get remote.origin.url 2>/dev/null)"
BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")"
ARCH=$(shell docker version -f {{.Client.Arch}})
OSS_FILES := go.mod Dockerfile
GOLANG_VERSION="1.16.7"


STAGING_REGISTRY ?= gcr.io/k8s-staging-cloud-provider-ibm
REGISTRY ?= $(STAGING_REGISTRY)
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
PULL_BASE_REF ?= $(RELEASE_TAG) # PULL_BASE_REF will be provided by Prow
RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF)

CORE_IMAGE_NAME ?= $(EXE_DRIVER_NAME)
CORE_DRIVER_IMG ?= $(REGISTRY)/$(CORE_IMAGE_NAME)

TAG ?= dev
ARCH ?= amd64
ALL_ARCH ?= amd64 ppc64le




# Jenkins vars. Set to `unknown` if the variable is not yet defined
BUILD_NUMBER?=unknown
GO111MODULE_FLAG?=on
export GO111MODULE=$(GO111MODULE_FLAG)

export LINT_VERSION="1.27.0"
export LINT_VERSION="1.31.0"

COLOR_YELLOW=\033[0;33m
COLOR_RESET=\033[0m
Expand All @@ -53,28 +68,28 @@ deps:

.PHONY: fmt
fmt: lint
golangci-lint run --disable-all --enable=gofmt --timeout 600s
@if [ -n "$$(golangci-lint run)" ]; then echo 'Please run ${COLOR_YELLOW}make dofmt${COLOR_RESET} on your code.' && exit 1; fi
$(GOPATH)/bin/golangci-lint run --disable-all --enable=gofmt --timeout 600s
@if [ -n "$$($(GOPATH)/bin/golangci-lint run)" ]; then echo 'Please run ${COLOR_YELLOW}make dofmt${COLOR_RESET} on your code.' && exit 1; fi

.PHONY: dofmt
dofmt:
golangci-lint run --disable-all --enable=gofmt --fix --timeout 600s
$(GOPATH)/bin/golangci-lint run --disable-all --enable=gofmt --fix --timeout 600s

.PHONY: lint
lint:
golangci-lint run --timeout 600s
$(GOPATH)/bin/golangci-lint run --timeout 600s

.PHONY: build
build:
CGO_ENABLED=0 GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) go build -mod=mod -a -ldflags '-X main.vendorVersion='"${DRIVER_NAME}-${GIT_COMMIT_SHA}"' -extldflags "-static"' -o ${GOPATH}/bin/${EXE_DRIVER_NAME} ./cmd/

.PHONY: test
test:
test: deps
$(GOPATH)/bin/gotestcover -v -race -short -coverprofile=cover.out ${GOPACKAGES}

.PHONY: ut-coverage
ut-coverage:
ut-coverage:

go tool cover -html=cover.out -o=cover.html

.PHONY: buildimage
Expand All @@ -86,11 +101,7 @@ buildimage: build-systemutil
--build-arg jenkins_build_number=${BUILD_NUMBER} \
--build-arg REPO_SOURCE_URL=${REPO_SOURCE_URL} \
--build-arg BUILD_URL=${BUILD_URL} \
--build-arg PROXY_IMAGE_URL=${PROXY_IMAGE_URL} \
-t $(IMAGE):$(VERSION)-$(ARCH) -f Dockerfile .
ifeq ($(ARCH), amd64)
docker tag $(IMAGE):$(VERSION)-$(ARCH) $(IMAGE):$(VERSION)
endif
-t $(CORE_DRIVER_IMG):$(ARCH)-$(TAG) -f Dockerfile .

.PHONY: build-systemutil
build-systemutil:
Expand All @@ -107,25 +118,65 @@ clean:
rm -rf ${EXE_DRIVER_NAME}
rm -rf $(GOPATH)/bin/${EXE_DRIVER_NAME}

.PHONY: runanalyzedeps
runanalyzedeps:
@docker build --rm --build-arg ARTIFACTORY_API_KEY="${ARTIFACTORY_API_KEY}" -t armada/analyze-deps -f Dockerfile.dependencycheck .
docker run -v `pwd`/dependency-check:/results armada/analyze-deps
## --------------------------------------
## Docker
## --------------------------------------

.PHONY: docker-build
docker-build: docker-pull-prerequisites buildimage ## Build the docker image for ibm-vpc-block-csi-driver

.PHONY: docker-push
docker-push: ## Push the docker image
docker push $(CORE_DRIVER_IMG):$(ARCH)-$(TAG)

.PHONY: docker-pull-prerequisites
docker-pull-prerequisites:
docker pull docker.io/docker/dockerfile:1.1-experimental
docker pull docker.io/library/golang:$(GOLANG_VERSION)
docker pull gcr.io/distroless/static:latest


## --------------------------------------
## Docker - All ARCH
## --------------------------------------

.PHONY: docker-build-all ## Build all the architecture docker images
docker-build-all: $(addprefix docker-build-,$(ALL_ARCH))

docker-build-%:
$(MAKE) ARCH=$* docker-build

.PHONY: docker-push-all ## Push all the architecture docker images
docker-push-all: $(addprefix docker-push-,$(ALL_ARCH))
$(MAKE) docker-push-core-manifest

docker-push-%:
$(MAKE) ARCH=$* docker-push

.PHONY: docker-push-core-manifest
docker-push-core-manifest: ## Push the fat manifest docker image.
## Minimum docker version 18.06.0 is required for creating and pushing manifest images.
$(MAKE) docker-push-manifest DRIVER_IMG=$(CORE_DRIVER_IMG) MANIFEST_FILE=$(CORE_MANIFEST_FILE)

.PHONY: analyzedeps
analyzedeps:
/tmp/dependency-check/bin/dependency-check.sh --enableExperimental --log /results/logfile --out /results --disableAssembly \
--suppress /src/dependency-check/suppression-file.xml --format JSON --prettyPrint --failOnCVSS 0 --scan /src
.PHONY: docker-push-manifest
docker-push-manifest:
docker manifest create --amend $(DRIVER_IMG):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(DRIVER_IMG):&-$(TAG)~g")
@for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${DRIVER_IMG}:${TAG} ${DRIVER_IMG}:$${arch}-${TAG}; done
docker manifest push --purge ${DRIVER_IMG}:${TAG}

.PHONY: showanalyzedeps
showanalyzedeps:
grep "VULNERABILITY FOUND" dependency-check/logfile;
cat dependency-check/dependency-check-report.json |jq '.dependencies[] | select(.vulnerabilities | length>0)';
## --------------------------------------
## Release
## --------------------------------------

.PHONY: updatebaseline
updatebaseline:
detect-secrets scan --update .secrets.baseline --all-files --exclude-files go.sum --db2-scan
.PHONY: release-alias-tag
release-alias-tag: # Adds the tag to the last build tag.
#gcloud container images add-tag -q $(CORE_DRIVER_IMG):$(TAG) $(CORE_DRIVER_IMG):$(RELEASE_ALIAS_TAG)
docker pull $(CORE_DRIVER_IMG):$(TAG)
docker tag $(CORE_DRIVER_IMG):$(TAG) $(CORE_DRIVER_IMG):$(RELEASE_ALIAS_TAG)
docker push $(CORE_DRIVER_IMG):$(RELEASE_ALIAS_TAG)

.PHONY: auditbaseline
auditbaseline:
detect-secrets audit .secrets.baseline
.PHONY: release-staging
release-staging: ## Builds and push container images to the staging image registry.
$(MAKE) docker-build-all
$(MAKE) docker-push-all
$(MAKE) release-alias-tag
12 changes: 3 additions & 9 deletions OWNERS
@@ -1,10 +1,4 @@

# See the OWNERS docs at https://go.k8s.io/owners

approvers:
- arahamad
- meghnasiingh
reviewers:
- arahamad
- meghnasiingh
- ambiknai
- openshift-storage-maintainers
component: "Storage"
subcomponent: Kubernetes External Components
7 changes: 7 additions & 0 deletions OWNERS_ALIASES
@@ -0,0 +1,7 @@
aliases:
openshift-storage-maintainers:
- bertinatto
- gnufied
- dobsonj
- jsafrane
- tsmetana
8 changes: 4 additions & 4 deletions README.md
@@ -1,7 +1,7 @@
# ibm-vpc-block-csi-driver

[![Build Status](https://app.travis-ci.com/IBM/ibm-vpc-block-csi-driver.svg?branch=master)](https://app.travis-ci.com/IBM/ibm-vpc-block-csi-driver)
[![code-coverage](https://github.com/IBM/ibm-vpc-block-csi-driver/blob/gh-pages/coverage/testbadge/badge.svg)](https://github.com/IBM/ibm-vpc-block-csi-driver/blob/gh-pages/coverage/testbadge/cover.html)
[![Build Status](https://prow.k8s.io/badge.svg?jobs=pull-ibm-vpc-block-csi-driver-build)](https://prow.k8s.io)
[![Coverage Status](https://coveralls.io/repos/github/kubernetes-sigs/ibm-vpc-block-csi-driver/badge.svg?branch=master)](https://coveralls.io/github/kubernetes-sigs/ibm-vpc-block-csi-driver?branch=master)

ibm-vpc-block-csi-driver is a CSI plugin for creating and mounting VPC block storage on IBM VPC infrastructure based openshift or kubernetes cluster

Expand Down Expand Up @@ -37,7 +37,7 @@ For building the driver `docker` and `GO` should be installed
```
$ mkdir -p $GOPATH/src/github.com/IBM
$ cd $GOPATH/src/github.com/IBM/
$ git clone https://github.com/IBM/ibm-vpc-block-csi-driver.git
$ git clone https://github.com/kubernetes-sigs/ibm-vpc-block-csi-driver.git
$ cd ibm-vpc-block-csi-driver
```
## Build project and runs testcases
Expand Down Expand Up @@ -106,7 +106,7 @@ For building the driver `docker` and `GO` should be installed

# How to contribute

If you have any questions or issues you can create a new issue [ here ](https://github.com/IBM/ibm-vpc-block-csi-driver/issues/new).
If you have any questions or issues you can create a new issue [ here ](https://github.com/kubernetes-sigs/ibm-vpc-block-csi-driver/issues/new).

Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:

Expand Down
18 changes: 18 additions & 0 deletions cloudbuild.yaml
@@ -0,0 +1,18 @@
# See https://cloud.google.com/cloud-build/docs/build-config
timeout: 3000s
options:
substitution_option: ALLOW_LOOSE
steps:
- name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20210722-085d930'
entrypoint: make
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
- TAG=$_GIT_TAG
- PULL_BASE_REF=$_PULL_BASE_REF
args:
- release-staging
substitutions:
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
# can be used as a substitution
_GIT_TAG: '12345'
_PULL_BASE_REF: 'dev'
4 changes: 2 additions & 2 deletions cmd/main.go
Expand Up @@ -36,8 +36,8 @@ import (
mountManager "github.com/IBM/ibm-csi-common/pkg/mountmanager"
"github.com/IBM/ibm-csi-common/pkg/utils"
"github.com/IBM/ibm-csi-common/pkg/watcher"
csiConfig "github.com/IBM/ibm-vpc-block-csi-driver/config"
driver "github.com/IBM/ibm-vpc-block-csi-driver/pkg/ibmcsidriver"
csiConfig "github.com/kubernetes-sigs/ibm-vpc-block-csi-driver/config"
driver "github.com/kubernetes-sigs/ibm-vpc-block-csi-driver/pkg/ibmcsidriver"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
Expand Down
Expand Up @@ -14,6 +14,6 @@ else
fi

readonly VERSION="${IKS_VPC_BLOCK_DRIVER_VERSION:-stable}"
readonly PKG_DIR="${GOPATH}/src/github.com/IBM/ibm-vpc-block-csi-driver"
readonly PKG_DIR="${GOPATH}/src/github.com/kubernetes-sigs/ibm-vpc-block-csi-driver"

kustomize build ${PKG_DIR}/deploy/kubernetes/driver/kubernetes/overlays/${VERSION} | kubectl delete --ignore-not-found -f -