Skip to content

Commit

Permalink
chore(build): add support for multiarch build (#32)
Browse files Browse the repository at this point in the history
* chore(build): add support for multiarch build
* moved docker files to respective dir
* this commit adds go mod download to speed builds it also bumps go version to 1.14.7
* this commit fixes some indentations and a typo in CONTRIBUTING.md
* migrate to docker/setup-buildx-action@v1 for buildx workflows
* replaced docker login with official action

Signed-off-by: shubham <[email protected]>
  • Loading branch information
shubham14bajpai authored Nov 11, 2020
1 parent fd566a8 commit 1009e9c
Show file tree
Hide file tree
Showing 12 changed files with 623 additions and 125 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# 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.
name: build

on: ['push']

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
path: '.'
pattern: '*.sh'
exclude: './vendor/*'

upgrade:
runs-on: ubuntu-latest
needs: ['lint']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set tag
run: |
BRANCH="${GITHUB_REF##*/}"
CI_TAG=${BRANCH#v}-ci
if [ ${BRANCH} = "master" ]; then
CI_TAG="ci"
fi
echo "::set-env name=TAG::${CI_TAG}"
echo "::set-env name=BRANCH::${BRANCH}"
echo "BRANCH: ${BRANCH}"
echo "TAG: ${CI_TAG}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push Image
env:
IMAGE_ORG: ${{ secrets.IMAGE_ORG}}
run: |
make docker.buildx.upgrade
make buildx.push.upgrade
migrate:
runs-on: ubuntu-latest
needs: ['lint']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set tag
run: |
BRANCH="${GITHUB_REF##*/}"
CI_TAG=${BRANCH#v}-ci
if [ ${BRANCH} = "master" ]; then
CI_TAG="ci"
fi
echo "::set-env name=TAG::${CI_TAG}"
echo "::set-env name=BRANCH::${BRANCH}"
echo "BRANCH: ${BRANCH}"
echo "TAG: ${CI_TAG}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push Image
env:
IMAGE_ORG: ${{ secrets.IMAGE_ORG}}
run: |
make docker.buildx.migrate
make buildx.push.migrate
84 changes: 84 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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.

name: ci

on:
pull_request:
branches:
# on pull requests to master and release branches
- master
- 'v*'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
path: '.'
pattern: '*.sh'
exclude: './vendor/*'

upgrade:
runs-on: ubuntu-latest
needs: ['lint']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Build Image
env:
IMG_RESULT: cache
run: make docker.buildx.upgrade

migrate:
runs-on: ubuntu-latest
needs: ['lint']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Build Image
env:
IMG_RESULT: cache
run: make docker.buildx.migrate
94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# 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.
name: release

on:
create:
tags:
- 'v*'

jobs:
upgrade:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Set Tag
run: |
TAG="${GITHUB_REF#refs/*/v}"
echo "::set-env name=TAG::${TAG}"
echo "::set-env name=RELEASE_TAG::${TAG}"
echo "RELEASE_TAG ${TAG}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push Image
env:
IMAGE_ORG: ${{ secrets.IMAGE_ORG}}
run: |
make docker.buildx.upgrade
make buildx.push.upgrade
migrate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Set Tag
run: |
TAG="${GITHUB_REF#refs/*/v}"
echo "::set-env name=TAG::${TAG}"
echo "::set-env name=RELEASE_TAG::${TAG}"
echo "RELEASE_TAG ${TAG}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push Image
env:
IMAGE_ORG: ${{ secrets.IMAGE_ORG}}
run: |
make docker.buildx.migrate
make buildx.push.migrate
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,28 @@ jobs:
- stage: "Tests"
os: linux
arch: amd64
env:
- INSTALL_MINIKUBE=false
script:
- make check-license
- make test
name: "Unit tests"
- os: linux
arch: amd64
env:
- INSTALL_MINIKUBE=true
script: ./ci/migrate/sanity.sh
name: "Migrate Sanity"
- os: linux
arch: amd64
env:
- INSTALL_MINIKUBE=true
script: ./ci/upgrade/sanity.sh
name: "Upgrade Sanity"
- stage: "Deploy Images"
os: linux
env:
- INSTALL_MINIKUBE=false
arch: amd64
script: make all.amd64 deploy-images

Expand All @@ -71,7 +79,7 @@ install:

before_script: # TODO add golangci yaml config
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.25.0
- if [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
- if [ "$INSTALL_MINIKUBE" == "true" ]; then
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.1/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/;
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.12.3/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/;
mkdir -p $HOME/.kube $HOME/.minikube;
Expand All @@ -80,6 +88,8 @@ before_script: # TODO add golangci yaml config
sudo chown -R travis /home/travis/.minikube/;
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done;
fi
- export RELEASE_TAG="$TRAVIS_TAG"
- export BRANCH="$TRAVIS_BRANCH"

notifications:
email:
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to OpenEBS Upgrade

NDM uses the standard GitHub pull requests process to review and accept contributions. There are several areas that could use your help. For starters, you could help in improving the sections in this document by either creating a new issue describing the improvement or submitting a pull request to this repository. The issues are maintained at [openebs/openebs](https://github.com/openebs/openebs/issues?q=is%3Aissue+is%3Aopen+label%3Andm) repository.
Upgrade uses the standard GitHub pull requests process to review and accept contributions. There are several areas that could use your help. For starters, you could help in improving the sections in this document by either creating a new issue describing the improvement or submitting a pull request to this repository. The issues are maintained at [openebs/openebs](https://github.com/openebs/openebs/issues?q=is%3Aopen+is%3Aissue+label%3A%22component%3A+Upgrade%22) repository.

* If you are a first-time contributor, please see [Steps to Contribute](#steps-to-contribute).
* If you want to file an issue for a bug or feature request, please see [Filing a issue](#filing-an-issue)
Expand All @@ -10,9 +10,9 @@ NDM uses the standard GitHub pull requests process to review and accept contribu

## Steps to Contribute

NDM is an Apache 2.0 Licensed project and all your commits should be signed with Developer Certificate of Origin. See [Sign your work](#sign-your-work).
Upgrade is an Apache 2.0 Licensed project and all your commits should be signed with Developer Certificate of Origin. See [Sign your work](#sign-your-work).

* Find an issue to work on or create a new issue. The issues are maintained at [openebs/openebs](https://github.com/openebs/openebs/issues?q=is%3Aissue+is%3Aopen+label%3Andm). You can pick up from a list of [good-first-issues](https://github.com/openebs/upgrade/labels/good%20first%20issue).
* Find an issue to work on or create a new issue. The issues are maintained at [openebs/openebs](https://github.com/openebs/openebs/issues?q=is%3Aopen+is%3Aissue+label%3A%22component%3A+Upgrade%22). You can pick up from a list of [good-first-issues](https://github.com/openebs/upgrade/labels/good%20first%20issue).
* Claim your issue by commenting your intent to work on it to avoid duplication of efforts.
* Fork the repository on GitHub.
* Create a branch from where you want to base your work (usually master).
Expand Down Expand Up @@ -69,7 +69,7 @@ When filing an issue, make sure to answer these seven questions:

For example:
```
feat(partition) : add support for partitions
feat(upgrade) : add support for jiva volume upgrades
^--^ ^-----^ ^-----------------------^
| | |
| | +-> PR subject, summary of the changes
Expand Down Expand Up @@ -130,5 +130,5 @@ This project is implemented using Go and uses the standard golang tools for deve

For setting up a Development environment on your local host, see the detailed instructions [here](./BUILD.md).

The NDM design document is available [here](./docs/design.md).
The Upgrade design document is available [here](https://github.com/openebs/openebs/tree/master/contribute/design/1.x/upgrade).

Loading

0 comments on commit 1009e9c

Please sign in to comment.