Skip to content

Commit

Permalink
chore(build): add travis for amd64 builds
Browse files Browse the repository at this point in the history
Signed-off-by: shubham <shubham.bajpai@mayadata.io>
  • Loading branch information
shubham14bajpai committed Nov 9, 2020
1 parent f83e83b commit 0d1ab21
Show file tree
Hide file tree
Showing 13 changed files with 403 additions and 67 deletions.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug Report
about: Report a bug encountered while using openebs exporter
labels: kind/bug

---

<!-- Please use this template while reporting a bug and provide as much info as possible.
Not doing so may result in your bug not being addressed in a timely manner. Thanks!
-->

**Describe the bug:** A clear and concise description of what the bug is.

**Expected behaviour:** A concise description of what you expected to happen

**Steps to reproduce the bug:**
Steps to reproduce the bug should be clear and easily reproducible to help people gain an understanding of the problem

**The output of the following commands will help us better understand what's going on**:
<!-- (Pasting long output into a [GitHub gist](https://gist.github.com) or other [Pastebin](https://pastebin.com/) is fine.) -->

* `kubectl get pods -n <openebs_namespace> --show-labels`
* `kubectl logs <upgrade_job_pod> -n <openebs_namespace>`

**Anything else we need to know?:**
Add any other context about the problem here.

**Environment details:**
- OpenEBS version (use `kubectl get po -n openebs --show-labels`):
- Kubernetes version (use `kubectl version`):
- Cloud provider or hardware configuration:
- OS (e.g: `cat /etc/os-release`):
- kernel (e.g: `uname -a`):
- others:
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Suggest an idea to improve openebs exporter
labels: Enhancement

---

**Describe the problem/challenge you have**
[A description of the current limitation/problem/challenge that you are experiencing.]


**Describe the solution you'd like**
[A clear and concise description of what you want to happen.]


**Anything else you would like to add:**
[Miscellaneous information that will assist in solving the issue.]


**Environment:**
- OpenEBS version (use `kubectl get po -n openebs --show-labels`):
- Kubernetes version (use `kubectl version`):
- Cloud provider or hardware configuration:
- OS (e.g: `cat /etc/os-release`):
- kernel (e.g: `uname -a`):
- others:
41 changes: 41 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Pull Request template

**Why is this PR required? What issue does it fix?**:

**What this PR does?**:

**Does this PR require any upgrade changes?**:

**If the changes in this PR are manually verified, list down the scenarios covered:**:

**Any additional information for your reviewer?** :
_Mention if this PR is part of any design or a continuation of previous PRs_


**Checklist:**
- [ ] Fixes #<issue number>
- [ ] PR Title follows the convention of `<type>(<scope>): <subject>`
- [ ] Has the change log section been updated?
- [ ] Commit has unit tests
- [ ] Commit has integration tests
- [ ] (Optional) Are upgrade changes included in this PR? If not, mention the issue/PR to track:
- [ ] (Optional) If documentation changes are required, which issue on https://github.com/openebs/openebs-docs is used to track them:


**PLEASE REMOVE BELOW INFORMATION BEFORE SUBMITTING**

The PR title message must follow convention:
`<type>(<scope>): <subject>`.

Where:
Most common types are:
* `feat` - for new features, not a new feature for build script
* `fix` - for bug fixes or improvements, not a fix for build script
* `chore` - changes not related to production code
* `docs` - changes related to documentation
* `style` - formatting, missing semi colons, linting fix etc; no significant production code changes
* `test` - adding missing tests, refactoring tests; no production code change
* `refactor` - refactoring production code, eg. renaming a variable or function name, there should not be any significant production code changes
* `cherry-pick` - if PR is merged in master branch and raised to release branch(like v0.4.x)

IMPORTANT: Please review the [CONTRIBUTING.md](../CONTRIBUTING.md) file for detailed contributing guidelines.
13 changes: 8 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ jobs:
- name: verify license
run: make check-license

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

- name: Verify corrections
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1

exporter:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -87,8 +90,8 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push Image
env:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ jobs:
- name: verify license
run: make check-license

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

- name: Verify corrections
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1

exporter:
runs-on: ubuntu-latest
needs: ['lint', 'test']
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push Image
env:
Expand Down
46 changes: 46 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
sudo: required

dist: xenial

env:
global:
- CAN_FAIL=false
- RELEASE_TAG_DOWNSTREAM=0
- RELEASE_TAG="$TRAVIS_TAG"
- BRANCH="$TRAVIS_BRANCH"

services:
- docker

language: go

cache:
directories:
- $HOME/.cache/go-build

go:
- 1.14.7

addons:
apt:
update: true

install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq

before_script:
- make test
- make verify-src

script:
- make exporter-image EXPORTER_IMAGE=m-exporter-amd64

after_success:
- make push EXPORTER_IMAGE=m-exporter-amd64

notifications:
email:
recipients:
- kiran.mova@mayadata.io
- shubham.bajpai@mayadata.io
45 changes: 36 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ export XC_ARCH
ARCH:=${XC_OS}_${XC_ARCH}
export ARCH

# list only the source code directories
PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/client/generated\|tests')

# list only the integration tests code directories
PACKAGES_IT = $(shell go list ./... | grep -v 'vendor\|pkg/client/generated' | grep 'tests')

# Specify the name for the binaries
EXPORTER=exporter

Expand Down Expand Up @@ -78,12 +84,33 @@ deps:
@go mod verify

.PHONY: test
test:
go test ./...
test: format vet
@echo "--> Running go test";
$(PWD)/build/test.sh ${XC_ARCH}

.PHONY: testv
testv: format
@echo "--> Running go test verbose" ;
@go test -v $(PACKAGES)

.PHONY: format
format:
@echo "--> Running go fmt"
@go fmt $(PACKAGES) $(PACKAGES_IT)

# -composite: avoid "literal copies lock value from fakePtr"
.PHONY: vet
vet:
@echo "--> Running go vet"
@go list ./... | grep -v "./vendor/*" | xargs go vet -composites

.PHONY: verify-src
verify-src:
@echo "--> Checking for git changes post running tests";
$(PWD)/build/check-diff.sh "format"

# Specify the name of the docker repo for amd64
EXPORTER_REPO_NAME="exporter"
EXPORTER_IMAGE_NAME="m-exporter"
EXPORTER_IMAGE?="m-exporter"

ifeq (${IMAGE_TAG}, )
IMAGE_TAG = ci
Expand Down Expand Up @@ -112,20 +139,20 @@ export DBUILD_ARGS=--build-arg BASE_IMAGE=$(CSTOR_BASE_IMAGE) --build-arg DBUILD
exporter-image: exporter
@echo "-----------------------------------------------"
@echo "--> ${EXPORTER} image "
@echo "${IMAGE_ORG}/${EXPORTER_IMAGE_NAME}:${IMAGE_TAG}"
@echo "${IMAGE_ORG}/${EXPORTER_IMAGE}:${IMAGE_TAG}"
@echo "-----------------------------------------------"
@cp bin/${EXPORTER}/${EXPORTER} build/${EXPORTER}
@cd build/${EXPORTER} && \
sudo docker build -t "${IMAGE_ORG}/${EXPORTER_IMAGE_NAME}:${IMAGE_TAG}" ${DBUILD_ARGS} .
sudo docker build -t "${IMAGE_ORG}/${EXPORTER_IMAGE}:${IMAGE_TAG}" ${DBUILD_ARGS} .
@rm build/${EXPORTER}/${EXPORTER}

.PHONY: all
all: check-license deps test exporter

# Push images
.PHONY: deploy-images
deploy-images:
@./build/deploy.sh
.PHONY: push
push:
DIMAGE=${IMAGE_ORG}/${EXPORTER_IMAGE} ./build/push.sh

.PHONY: check_license
check-license:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.buildx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ docker.buildx.exporter:

.PHONY: buildx.push.exporter
buildx.push.exporter:
BUILDX=true DIMAGE=${IMAGE_ORG}/exporter ./build/buildxpush.sh
BUILDX=true DIMAGE=${IMAGE_ORG}/m-exporter ./build/push.sh

47 changes: 0 additions & 47 deletions build/buildxpush.sh

This file was deleted.

26 changes: 26 additions & 0 deletions build/check-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Copyright 2018-2020 The OpenEBS Authors. 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script checks if any files are modified by tests like go fmt.

set -e

# message to be displayed if test fails.
TEST_NAME=$1


if [[ `git diff --shortstat | wc -l` != 0 ]]; then
echo "Some files got changed after $1";printf "\n";git diff --stat;printf "\n"; exit 1;
fi
Loading

0 comments on commit 0d1ab21

Please sign in to comment.