mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
refact(actions): use build & push action instead of makefile (#315)
Signed-off-by: shubham <shubham.bajpai@mayadata.io>
This commit is contained in:
parent
cb3ae22f7a
commit
be4334f7c4
4 changed files with 121 additions and 19 deletions
65
.github/workflows/build.yml
vendored
65
.github/workflows/build.yml
vendored
|
|
@ -13,10 +13,21 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
name: build
|
name: build
|
||||||
|
|
||||||
on: ['push']
|
on:
|
||||||
|
create:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- 'v*'
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
- 'changelogs/**'
|
||||||
|
- 'deploy/helm/**'
|
||||||
|
- 'CHANGELOG.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
|
if: ${{ (github.event.ref_type == 'branch') }} # to ignore builds on release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -33,6 +44,7 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
unit-test:
|
unit-test:
|
||||||
|
if: ${{ (github.event.ref_type == 'branch') }} # to ignore builds on release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -97,6 +109,12 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set Image Org
|
||||||
|
# sets the default IMAGE_ORG to openebs
|
||||||
|
run: |
|
||||||
|
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
|
||||||
|
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set Tag
|
- name: Set Tag
|
||||||
run: |
|
run: |
|
||||||
BRANCH="${GITHUB_REF##*/}"
|
BRANCH="${GITHUB_REF##*/}"
|
||||||
|
|
@ -107,10 +125,28 @@ jobs:
|
||||||
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
|
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
|
||||||
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
|
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set Build Date
|
||||||
|
id: date
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=DATE::$(date -u +'%Y-%m-%dT%H:%M:%S%Z')"
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: docker_meta
|
||||||
|
uses: crazy-max/ghaction-docker-meta@v1
|
||||||
|
with:
|
||||||
|
# add each registry to which the image needs to be pushed here
|
||||||
|
images: |
|
||||||
|
${{ env.IMAGE_ORG }}/zfs-driver
|
||||||
|
quay.io/${{ env.IMAGE_ORG }}/zfs-driver
|
||||||
|
tag-latest: false
|
||||||
|
tag-custom-only: true
|
||||||
|
tag-custom: |
|
||||||
|
${{ env.TAG }}
|
||||||
|
|
||||||
- name: Print Tag info
|
- name: Print Tag info
|
||||||
run: |
|
run: |
|
||||||
echo "BRANCH: ${BRANCH}"
|
echo "BRANCH: ${BRANCH}"
|
||||||
echo "TAG: ${TAG}"
|
echo "${{ steps.docker_meta.outputs.tags }}"
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
@ -129,9 +165,24 @@ jobs:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Quay
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: quay.io
|
||||||
|
username: ${{ secrets.QUAY_USERNAME }}
|
||||||
|
password: ${{ secrets.QUAY_TOKEN }}
|
||||||
|
|
||||||
- name: Build & Push Image
|
- name: Build & Push Image
|
||||||
env:
|
uses: docker/build-push-action@v2
|
||||||
IMAGE_ORG: ${{ secrets.IMAGE_ORG}}
|
with:
|
||||||
run: |
|
context: .
|
||||||
make docker.buildx.csi-driver
|
file: ./buildscripts/zfs-driver/zfs-driver.Dockerfile
|
||||||
make buildx.push.csi-driver
|
push: true
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
|
tags: |
|
||||||
|
${{ steps.docker_meta.outputs.tags }}
|
||||||
|
build-args: |
|
||||||
|
DBUILD_DATE=${{ steps.date.outputs.DATE }}
|
||||||
|
DBUILD_REPO_URL=https://github.com/openebs/zfs-localpv
|
||||||
|
DBUILD_SITE_URL=https://openebs.io
|
||||||
|
BRANCH=${{ env.BRANCH }}
|
||||||
|
|
|
||||||
16
.github/workflows/pull_request.yml
vendored
16
.github/workflows/pull_request.yml
vendored
|
|
@ -18,6 +18,9 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'deploy/helm/**'
|
- 'deploy/helm/**'
|
||||||
|
- 'docs/**'
|
||||||
|
- 'changelogs/**'
|
||||||
|
- 'CHANGELOG.md'
|
||||||
branches:
|
branches:
|
||||||
# on pull requests to master and release branches
|
# on pull requests to master and release branches
|
||||||
- master
|
- master
|
||||||
|
|
@ -116,7 +119,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
version: v0.4.2
|
version: v0.4.2
|
||||||
|
|
||||||
- name: Build Image
|
- name: Build
|
||||||
env:
|
uses: docker/build-push-action@v2
|
||||||
IMG_RESULT: cache
|
with:
|
||||||
run: make docker.buildx.csi-driver
|
context: .
|
||||||
|
file: ./buildscripts/zfs-driver/zfs-driver.Dockerfile
|
||||||
|
push: false
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
|
tags: |
|
||||||
|
openebs/zfs-driver:ci
|
||||||
|
|
|
||||||
53
.github/workflows/release.yml
vendored
53
.github/workflows/release.yml
vendored
|
|
@ -14,7 +14,9 @@
|
||||||
name: release
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
|
types:
|
||||||
|
- "created"
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
|
|
@ -25,14 +27,38 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Set Image Org
|
||||||
|
# sets the default IMAGE_ORG to openebs
|
||||||
|
run: |
|
||||||
|
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
|
||||||
|
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set Tag
|
- name: Set Tag
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF#refs/*/v}"
|
TAG="${GITHUB_REF#refs/*/v}"
|
||||||
echo "TAG=${TAG}" >> $GITHUB_ENV
|
echo "TAG=${TAG}" >> $GITHUB_ENV
|
||||||
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
|
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set Build Date
|
||||||
|
id: date
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=DATE::$(date -u +'%Y-%m-%dT%H:%M:%S%Z')"
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: docker_meta
|
||||||
|
uses: crazy-max/ghaction-docker-meta@v1
|
||||||
|
with:
|
||||||
|
# add each registry to which the image needs to be pushed here
|
||||||
|
images: |
|
||||||
|
${{ env.IMAGE_ORG }}/zfs-driver
|
||||||
|
quay.io/${{ env.IMAGE_ORG }}/zfs-driver
|
||||||
|
tag-latest: true
|
||||||
|
tag-semver: |
|
||||||
|
{{version}}
|
||||||
|
|
||||||
- name: Print Tag info
|
- name: Print Tag info
|
||||||
run: |
|
run: |
|
||||||
|
echo "${{ steps.docker_meta.outputs.tags }}"
|
||||||
echo "RELEASE TAG: ${RELEASE_TAG}"
|
echo "RELEASE TAG: ${RELEASE_TAG}"
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
|
|
@ -52,9 +78,24 @@ jobs:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Quay
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: quay.io
|
||||||
|
username: ${{ secrets.QUAY_USERNAME }}
|
||||||
|
password: ${{ secrets.QUAY_TOKEN }}
|
||||||
|
|
||||||
- name: Build & Push Image
|
- name: Build & Push Image
|
||||||
env:
|
uses: docker/build-push-action@v2
|
||||||
IMAGE_ORG: ${{ secrets.IMAGE_ORG}}
|
with:
|
||||||
run: |
|
context: .
|
||||||
make docker.buildx.csi-driver
|
file: ./buildscripts/zfs-driver/zfs-driver.Dockerfile
|
||||||
make buildx.push.csi-driver
|
push: true
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
|
tags: |
|
||||||
|
${{ steps.docker_meta.outputs.tags }}
|
||||||
|
build-args: |
|
||||||
|
DBUILD_DATE=${{ steps.date.outputs.DATE }}
|
||||||
|
DBUILD_REPO_URL=https://github.com/openebs/zfs-localpv
|
||||||
|
DBUILD_SITE_URL=https://openebs.io
|
||||||
|
RELEASE_TAG=${{ env.RELEASE_TAG }}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ echo '
|
||||||
|
|
||||||
cat deploy/yamls/zfs.openebs.io_zfsvolumes.yaml >> deploy/yamls/zfsvolume-crd.yaml
|
cat deploy/yamls/zfs.openebs.io_zfsvolumes.yaml >> deploy/yamls/zfsvolume-crd.yaml
|
||||||
rm deploy/yamls/zfs.openebs.io_zfsvolumes.yaml
|
rm deploy/yamls/zfs.openebs.io_zfsvolumes.yaml
|
||||||
|
cp deploy/yamls/zfsvolume-crd.yaml deploy/helm/charts/crds/zfsvolume.yaml
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ echo '
|
||||||
|
|
||||||
cat deploy/yamls/zfs.openebs.io_zfssnapshots.yaml >> deploy/yamls/zfssnapshot-crd.yaml
|
cat deploy/yamls/zfs.openebs.io_zfssnapshots.yaml >> deploy/yamls/zfssnapshot-crd.yaml
|
||||||
rm deploy/yamls/zfs.openebs.io_zfssnapshots.yaml
|
rm deploy/yamls/zfs.openebs.io_zfssnapshots.yaml
|
||||||
|
cp deploy/yamls/zfssnapshot-crd.yaml deploy/helm/charts/crds/zfssnapshot.yaml
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
|
|
@ -77,7 +78,7 @@ echo '
|
||||||
|
|
||||||
cat deploy/yamls/zfs.openebs.io_zfsbackups.yaml >> deploy/yamls/zfsbackup-crd.yaml
|
cat deploy/yamls/zfs.openebs.io_zfsbackups.yaml >> deploy/yamls/zfsbackup-crd.yaml
|
||||||
rm deploy/yamls/zfs.openebs.io_zfsbackups.yaml
|
rm deploy/yamls/zfs.openebs.io_zfsbackups.yaml
|
||||||
|
cp deploy/yamls/zfsbackup-crd.yaml deploy/helm/charts/crds/zfsbackup.yaml
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
|
|
@ -93,6 +94,7 @@ echo '
|
||||||
|
|
||||||
cat deploy/yamls/zfs.openebs.io_zfsrestores.yaml >> deploy/yamls/zfsrestore-crd.yaml
|
cat deploy/yamls/zfs.openebs.io_zfsrestores.yaml >> deploy/yamls/zfsrestore-crd.yaml
|
||||||
rm deploy/yamls/zfs.openebs.io_zfsrestores.yaml
|
rm deploy/yamls/zfs.openebs.io_zfsrestores.yaml
|
||||||
|
cp deploy/yamls/zfsrestore-crd.yaml deploy/helm/charts/crds/zfsrestore.yaml
|
||||||
|
|
||||||
## create the operator file using all the yamls
|
## create the operator file using all the yamls
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue