From 6a00845670099dabe994f47fe4fd0c0596fe7182 Mon Sep 17 00:00:00 2001 From: Michael Marshall Date: Mon, 17 Oct 2022 12:39:04 -0700 Subject: [PATCH] Remove GitHub Action Workflows that release the chart (#300) Relates to: https://github.com/apache/pulsar-helm-chart/issues/290 ### Motivation We should not use GitHub Actions to release the helm chart. As such, we can remove the relevant workflow code from this repo while we build the relevant process to officially release the helm chart. The main risk with this kind of change is that we won't have a way to "release" the chart. However, it is relevant to point out that we have not had any official releases of the chart given that the PMC has not been voting on the releases. I think we need to prioritize fixing this process as a community. ### Modifications * Remove all scripts and configuration files that enabled GitHub Actions to release the helm chart. ### Verifying this change This is a trivial change. --- .ci/release.sh | 117 ------------------ .../workflows/cancel-duplicate-workflows.yml | 12 -- .github/workflows/release.yml | 55 -------- .github/workflows/verify_release.yml | 55 -------- 4 files changed, 239 deletions(-) delete mode 100755 .ci/release.sh delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/verify_release.yml diff --git a/.ci/release.sh b/.ci/release.sh deleted file mode 100755 index e9b3358..0000000 --- a/.ci/release.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env bash -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# - - -BINDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -CHARTS_HOME="$(cd "${BINDIR}/.." && pwd)" -CHARTS_PKGS=${CHARTS_HOME}/.chart-packages -CHARTS_INDEX=${CHARTS_HOME}/.chart-index -CHARTS_REPO=${CHARTS_REPO:-"https://pulsar.apache.org/charts/"} -OWNER=${OWNER:-apache} -REPO=${REPO:-pulsar-helm-chart} -PUBLISH_CHARTS=${PUBLISH_CHARTS:-"false"} -PULSAR_SITE_REPO_SLUG=${PULSAR_SITE_REPO_SLUG:-"apache/pulsar-site"} -PULSAR_SITE_BRANCH=${PULSAR_SITE_BRANCH:-"asf-site-next"} - -# hack/common.sh need this variable to be set -PULSAR_CHART_HOME=${CHARTS_HOME} - -source ${CHARTS_HOME}/hack/common.sh -source ${CHARTS_HOME}/.ci/git.sh - -# allow overwriting cr binary -CR="docker run -v ${CHARTS_HOME}:/cr quay.io/helmpack/chart-releaser:v${CR_VERSION}" - -function release::ensure_dir() { - local dir=$1 - if [[ -d ${dir} ]]; then - rm -rf ${dir} - fi - mkdir -p ${dir} -} - -function release::find_changed_charts() { - local charts_dir=$1 - echo $(git diff --find-renames --name-only "$latest_tag_rev" -- ${charts_dir} | cut -d '/' -f 2 | uniq) -} - -function release::package_chart() { - local chart=$1 - echo "Packaging chart '$chart'..." - helm package ${CHARTS_HOME}/charts/$chart --destination ${CHARTS_PKGS} -} - -function release::upload_packages() { - ${CR} upload --owner ${OWNER} --git-repo ${REPO} -t ${GITHUB_TOKEN} --package-path /cr/.chart-packages -} - -function release::update_chart_index() { - ${CR} index -o ${OWNER} -r ${REPO} -t "${GITHUB_TOKEN}" -c ${CHARTS_REPO} --index-path /cr/.chart-index --package-path /cr/.chart-packages -} - -function release::git_setup() { - git config --global user.email "dev@pulsar.apache.org" - git config --global user.name "Apache Pulsar Team" -} - -function release::publish_charts() { - release::git_setup - git clone -b "$PULSAR_SITE_BRANCH" --depth 1 "https://${GITHUB_TOKEN}@github.com/${PULSAR_SITE_REPO_SLUG}" pulsar-site - cd pulsar-site - mkdir -p content/charts - cp --force ${CHARTS_INDEX}/index.yaml content/charts/index.yaml - git add content/charts/index.yaml - ls content/charts - git commit --message="Publish new charts to ${CHARTS_REPO}" --signoff - if [[ "x${PUBLISH_CHARTS}" == "xtrue" ]]; then - git push --set-upstream origin "$PULSAR_SITE_BRANCH" - else - echo "Skipping publishing charts" - fi -} - -# install cr -# hack::ensure_cr -docker pull quay.io/helmpack/chart-releaser:v${CR_VERSION} - -latest_tag=$(git::find_latest_tag) -echo "Latest tag: $latest_tag" - -latest_tag_rev=$(git::get_revision "$latest_tag") -echo "$latest_tag_rev $latest_tag (latest tag)" - -head_rev=$(git::get_revision HEAD) -echo "$head_rev HEAD" - -if [[ "$latest_tag_rev" == "$head_rev" ]]; then - echo "Do nothing. Exiting ..." - exit -fi - -release::ensure_dir ${CHARTS_PKGS} -release::ensure_dir ${CHARTS_INDEX} - -for chart in $(release::find_changed_charts charts); do - release::package_chart ${chart} -done - -release::upload_packages -release::update_chart_index -release::publish_charts diff --git a/.github/workflows/cancel-duplicate-workflows.yml b/.github/workflows/cancel-duplicate-workflows.yml index 502b1f5..5e42894 100644 --- a/.github/workflows/cancel-duplicate-workflows.yml +++ b/.github/workflows/cancel-duplicate-workflows.yml @@ -97,22 +97,10 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} cancelMode: allDuplicates workflowFileName: pulsar_zk_tls.yml - - name: cancel duplicate release.yml - uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738 - with: - token: ${{ secrets.GITHUB_TOKEN }} - cancelMode: allDuplicates - workflowFileName: release.yml - name: cancel duplicate style.yml uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738 with: token: ${{ secrets.GITHUB_TOKEN }} cancelMode: allDuplicates workflowFileName: style.yml - - name: cancel duplicate verify_release.yml - uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738 - with: - token: ${{ secrets.GITHUB_TOKEN }} - cancelMode: allDuplicates - workflowFileName: verify_release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index a61b443..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,55 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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: Post commit - Publish Pulsar Helm Chart -on: - push: - branches: - - master -jobs: - release: - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.PULSARBOT_TOKEN }} - fetch-depth: 0 - - - name: Tune Runner VM - uses: ./.github/actions/tune-runner-vm - - - name: Detect changed files - id: changes - uses: apache/pulsar-test-infra/paths-filter@master - with: - filters: .github/changes-filter.yaml - - - name: Check changed files - id: check_changes - run: echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}" - - - name: Release chart - if: ${{ steps.check_changes.outputs.docs_only != 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.PULSARBOT_TOKEN }} - PUBLISH_CHARTS: true - run: | - .ci/release.sh diff --git a/.github/workflows/verify_release.yml b/.github/workflows/verify_release.yml deleted file mode 100644 index 698a908..0000000 --- a/.github/workflows/verify_release.yml +++ /dev/null @@ -1,55 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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: Precommit - Verify releasing Pulsar Helm Chart -on: - pull_request: - branches: - - '*' - -jobs: - release: - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - name: checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Tune Runner VM - uses: ./.github/actions/tune-runner-vm - - - name: Detect changed files - id: changes - uses: apache/pulsar-test-infra/paths-filter@master - with: - filters: .github/changes-filter.yaml - - - name: Check changed files - id: check_changes - run: echo "::set-output name=docs_only::${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}" - - - name: Verify release - if: ${{ steps.check_changes.outputs.docs_only != 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PUBLISH_CHARTS: false - run: | - .ci/release.sh