diff --git a/.github/workflows/build.yml b/.github/workflows/build_and_push.yml similarity index 58% rename from .github/workflows/build.yml rename to .github/workflows/build_and_push.yml index 5c9dc2c2..c596bf5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build_and_push.yml @@ -1,66 +1,44 @@ -# Copyright 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 +name: Build and Push on: create: push: branches: - - 'develop' - - 'v*' + - develop + - "release/**" paths-ignore: - - '*.md' - - 'BUILDMETA' - - 'changelogs/**' - - 'deploy/helm/**' - - 'docs/**' - - 'LICENSE' - - 'MAINTAINERS' + - "*.md" + - "BUILDMETA" + - "changelogs/**" + - "deploy/helm/**" + - "docs/**" + - "design/**" + - "LICENSE" + - "MAINTAINERS" jobs: lint: - # to ignore builds on release - if: ${{ (github.event.ref_type != 'tag') }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - - name: Shellcheck - uses: reviewdog/action-shellcheck@v1 with: - github_token: ${{ secrets.github_token }} - reporter: github-pr-review - path: '.' - pattern: '*.sh' - exclude: './.git/*' + fetch-depth: 0 - - name: Set up Go 1.19 - uses: actions/setup-go@v5 + - uses: cachix/install-nix-action@v22 + - uses: rrbutani/use-nix-shell-action@v1.1.0 with: - go-version: 1.19.9 - cache: false + file: shell.nix - - name: Lint Check - uses: golangci/golangci-lint-action@v4 - with: - version: v1.56.2 - args: -E exportloopref,dupl,revive,bodyclose,goconst,misspell -D structcheck --timeout 5m0s + - name: Check if the chart follows a valid semver version + run: | + BRANCH=${{ github.ref_name }} + ./scripts/validate-chart-version.sh --branch $BRANCH + - name: Run chart-testing lint + run: | + ct lint --config ct.yaml - unit-test: - # to ignore builds on release - if: ${{ (github.event.ref_type != 'tag') }} + unit-tests: runs-on: ubuntu-latest steps: - name: Checkout @@ -76,15 +54,15 @@ jobs: run: make test - name: Upload Coverage Report - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.txt name: coverage-$(date +%s) flags: unittests - bdd-test: - needs: ['unit-test'] + bdd-tests: + needs: ["unit-tests"] runs-on: ubuntu-latest strategy: fail-fast: true @@ -108,7 +86,7 @@ jobs: driver: none kubernetes-version: ${{ matrix.kubernetes }} cni: calico - start-args: '--install-addons=false' + start-args: "--install-addons=false" - name: Build images locally run: make lvm-driver-image || exit 1; @@ -127,44 +105,14 @@ jobs: name: coverage-bdd_coverage-$(date +%s) flags: bddtests - ansible: - runs-on: ubuntu-latest - needs: ['lint', 'unit-test', 'bdd-test'] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - 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: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push the ansible image - uses: docker/build-push-action@v5 - with: - file: ./e2e-tests/Dockerfile - push: true - load: false - platforms: linux/amd64 - tags: | - ${{ env.IMAGE_ORG }}/lvm-localpv-e2e:ci - csi-driver: runs-on: ubuntu-latest - needs: ['lint', 'unit-test', 'bdd-test'] + needs: ["lint", "bdd-tests"] steps: - name: Checkout uses: actions/checkout@v4 - 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 @@ -174,15 +122,11 @@ jobs: run: | echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT - - name: Set Tag + - name: Set IMAGE_TAG and BRANCH run: | - BRANCH="${GITHUB_REF##*/}" - CI_TAG=${BRANCH#v}-ci - if [ ${BRANCH} = "develop" ]; then - CI_TAG="ci" - fi - echo "TAG=${CI_TAG}" >> $GITHUB_ENV - echo "BRANCH=${BRANCH}" >> $GITHUB_ENV + BRANCH=${{ github.ref_name }} + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $$2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV - name: Docker meta id: docker_meta @@ -195,11 +139,11 @@ jobs: ghcr.io/${{ env.IMAGE_ORG }}/lvm-driver tags: | type=raw,value=latest,enable=false - type=raw,value=${{ env.TAG }} + type=raw,value=${{ env.IMAGE_TAG }} - name: Print Tag info run: | - echo "BRANCH: ${BRANCH}" + echo "BRANCH: ${env.BRANCH}" echo "${{ steps.docker_meta.outputs.tags }}" - name: Set up QEMU @@ -247,3 +191,14 @@ jobs: DBUILD_REPO_URL=https://github.com/openebs/lvm-localpv DBUILD_SITE_URL=https://openebs.io BRANCH=${{ env.BRANCH }} + + release-chart: + runs-on: ubuntu-latest + needs: ["csi-driver"] + steps: + - uses: actions/checkout@v4 + - name: Publish lvm localpv develop or prerelease helm chart + uses: stefanprodan/helm-gh-pages@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + charts_dir: ./deploy/helm diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 47e18d80..a5e6cba5 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -3,16 +3,16 @@ name: Pull Request CI on: pull_request: branches: - - 'develop' - - 'release/**' + - develop + - "release/**" paths-ignore: - - '*.md' - - 'BUILDMETA' - - 'changelogs/**' - - 'docs/**' - - 'design/**' - - 'LICENSE' - - 'MAINTAINERS' + - "*.md" + - "BUILDMETA" + - "changelogs/**" + - "docs/**" + - "design/**" + - "LICENSE" + - "MAINTAINERS" jobs: lint: @@ -29,12 +29,6 @@ jobs: go-version: 1.19.9 cache: false - - name: Format test - run: make format - - - name: bootstrap - run: make bootstrap - - name: Lint Check uses: golangci/golangci-lint-action@v4 with: @@ -46,19 +40,19 @@ jobs: with: github_token: ${{ secrets.github_token }} reporter: github-pr-review - path: '.' - pattern: '*.sh' + path: "." + pattern: "*.sh" - uses: cachix/install-nix-action@v22 - uses: rrbutani/use-nix-shell-action@v1.1.0 with: file: shell.nix - # - name: Check if the chart follows a valid semver version - # run: | - # branch_name="${{ github.event.pull_request.base.ref }}" - # ./scripts/validate-chart-version.sh --branch $branch_name - + - name: Check if the chart follows a valid semver version + run: | + branch_name="${{ github.event.pull_request.base.ref }}" + ./scripts/validate-chart-version.sh --branch $branch_name + - name: Run chart-testing lint run: | ct lint --config ct.yaml @@ -79,7 +73,7 @@ jobs: run: make test - name: Upload Coverage Report - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.txt @@ -87,7 +81,7 @@ jobs: flags: unittests bdd-tests: - needs: ['unit-tests'] + needs: ["unit-tests"] runs-on: ubuntu-latest strategy: fail-fast: true @@ -96,11 +90,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - - uses: cachix/install-nix-action@v22 - - uses: rrbutani/use-nix-shell-action@v1.1.0 - with: - file: shell.nix - name: Set up Go 1.19 uses: actions/setup-go@v5 @@ -119,7 +108,7 @@ jobs: driver: none kubernetes-version: ${{ matrix.kubernetes }} cni: calico - start-args: '--install-addons=false' + start-args: "--install-addons=false" - name: Setting environment variables run: | @@ -142,7 +131,7 @@ jobs: csi-driver: runs-on: ubuntu-latest - needs: ['lint', 'unit-tests', 'bdd-tests'] + needs: ["lint", "unit-tests", "bdd-tests"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/release-charts.yml b/.github/workflows/release-charts.yml deleted file mode 100644 index 29b90c41..00000000 --- a/.github/workflows/release-charts.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Release Charts - -on: - push: - paths: - - 'deploy/helm/**' - branches: - - develop - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Install Helm - uses: azure/setup-helm@v4 - with: - version: v3.14.3 - - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - env: - CR_TOKEN: "${{ secrets.CR_TOKEN }}" - with: - charts_dir: deploy/helm diff --git a/ci/ci-test.sh b/ci/ci-test.sh index 5b80a065..0d884afd 100755 --- a/ci/ci-test.sh +++ b/ci/ci-test.sh @@ -15,6 +15,7 @@ fi # foreign systemid for the testing environment. FOREIGN_LVM_SYSTEMID="openebs-ci-test-system" FOREIGN_LVM_CONFIG="global{system_id_source=lvmlocal}local{system_id=${FOREIGN_LVM_SYSTEMID}}" +CRDS_TO_DELETE_ON_CLEANUP="lvmnodes.local.openebs.io lvmsnapshots.local.openebs.io lvmvolumes.local.openebs.io volumesnapshotclasses.snapshot.storage.k8s.io volumesnapshotcontents.snapshot.storage.k8s.io volumesnapshots.snapshot.storage.k8s.io" # Clean up generated resources for successive tests. cleanup_loopdev() { @@ -41,10 +42,11 @@ cleanup() { cleanup_foreign_lvmvg - kubectl delete pvc -n openebs lvmpv-pvc + kubectl delete pvc -n "$OPENEBS_NAMESPACE" lvmpv-pvc kubectl delete -f "${SNAP_CLASS}" helm uninstall lvm-localpv -n "$OPENEBS_NAMESPACE" || true + kubectl delete crds "$CRDS_TO_DELETE_ON_CLEANUP" # always return true return 0 } @@ -70,7 +72,6 @@ sudo sed -i '/^[^#]*thin_pool_autoextend_percent/ s/= .*/= 20/' /etc/lvm/lvm.con # Prepare env for running BDD tests # Minikube is already running - helm install lvm-localpv ./deploy/helm/charts -n "$OPENEBS_NAMESPACE" --create-namespace --set lvmPlugin.pullPolicy=Never --set analytics.enabled=false kubectl apply -f "${SNAP_CLASS}" @@ -160,10 +161,10 @@ echo "get sc details" kubectl get sc --all-namespaces -oyaml echo "get lvm volume details" -kubectl get lvmvolumes.local.openebs.io -n openebs -oyaml +kubectl get lvmvolumes.local.openebs.io -n "$OPENEBS_NAMESPACE" -oyaml echo "get lvm snapshot details" -kubectl get lvmsnapshots.local.openebs.io -n openebs -oyaml +kubectl get lvmsnapshots.local.openebs.io -n "$OPENEBS_NAMESPACE" -oyaml exit 1 fi diff --git a/deploy/helm/charts/Chart.yaml b/deploy/helm/charts/Chart.yaml index d89f5eff..ee72696a 100644 --- a/deploy/helm/charts/Chart.yaml +++ b/deploy/helm/charts/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: lvm-localpv description: CSI Driver for dynamic provisioning of LVM Persistent Local Volumes. -version: 1.6.2 -appVersion: 1.6.1 +version: 1.7.0-develop +appVersion: 1.7.0-develop icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/icon/color/openebs-icon-color.png home: https://openebs.io/ keywords: @@ -16,5 +16,5 @@ sources: - https://github.com/openebs/lvm-localpv dependencies: - name: crds - version: 1.6.2 + version: 1.7.0-develop condition: crds.enabled diff --git a/deploy/helm/charts/charts/crds/Chart.yaml b/deploy/helm/charts/charts/crds/Chart.yaml index 16f48daf..c5d90db1 100644 --- a/deploy/helm/charts/charts/crds/Chart.yaml +++ b/deploy/helm/charts/charts/crds/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v2 name: crds -version: 1.6.2 +version: 1.7.0-develop description: A Helm chart that collects CustomResourceDefinitions (CRDs) from lvm-localpv. diff --git a/deploy/helm/charts/templates/lvm-controller.yaml b/deploy/helm/charts/templates/lvm-controller.yaml index 4d65181b..345e497f 100644 --- a/deploy/helm/charts/templates/lvm-controller.yaml +++ b/deploy/helm/charts/templates/lvm-controller.yaml @@ -109,7 +109,7 @@ spec: value: controller - name: OPENEBS_CSI_ENDPOINT value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock - - name: LVM_NAMESPACE + - name: OPENEBS_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace diff --git a/deploy/helm/charts/templates/lvm-node.yaml b/deploy/helm/charts/templates/lvm-node.yaml index a72c83e8..209f5a00 100644 --- a/deploy/helm/charts/templates/lvm-node.yaml +++ b/deploy/helm/charts/templates/lvm-node.yaml @@ -91,7 +91,7 @@ spec: value: unix:///plugin/csi.sock - name: OPENEBS_NODE_DRIVER value: agent - - name: LVM_NAMESPACE + - name: OPENEBS_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace diff --git a/deploy/helm/charts/values.yaml b/deploy/helm/charts/values.yaml index 255ca067..aa4453b4 100644 --- a/deploy/helm/charts/values.yaml +++ b/deploy/helm/charts/values.yaml @@ -149,7 +149,7 @@ lvmPlugin: repository: openebs/lvm-driver pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: 1.6.1 + tag: 1.7.0-develop ioLimits: enabled: false containerRuntime: containerd