diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index a5fbb5cc87..44d5292723 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -105,6 +105,11 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} token: ${{ secrets.BITNAMI_BOT_TOKEN }} + path: charts + - name: Clone upstream bitnami/charts repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 + with: + path: upstream-charts - name: Setup git configuration run: | git config user.name "Bitnami Containers" @@ -114,8 +119,10 @@ jobs: # regenerate the changelog too - name: Unshallow main branch and get tags run: | + cd ~/upstream-charts git fetch origin main --unshallow git fetch --tags + cd .. - name: Install conventional-changelog-cli run: npm install -g conventional-changelog-cli - id: generate-changelog @@ -123,12 +130,14 @@ jobs: env: CHART: ${{ needs.get-chart.outputs.chart }} run: | + cd ~/upstream-charts # The generator needs the file to exist - chart_version="$(yq e '.version' bitnami/${CHART}/Chart.yaml)" - changelog_file="bitnami/${CHART}/CHANGELOG.md" - changelog_tmp="bitnami/${CHART}/CHANGELOG.md.tmp" + chart_version="$(yq e '.version' ~/charts/bitnami/${CHART}/Chart.yaml)" + changelog_file="~/charts/bitnami/${CHART}/CHANGELOG.md" + changelog_tmp="~/charts/bitnami/${CHART}/CHANGELOG.md.tmp" touch "$changelog_file" npx conventional-changelog-cli -i ${changelog_file} -s -t ${CHART}/ -r 0 --commit-path bitnami/${CHART} + cd ~/charts # Remove unreleased section (includes all intermediate commits in the branch) and create future entry based on PR title # The unreleased section looks like this "## (YYYY-MM-DD)" whereas a released section looks like this "## 0.0.1 (YYYY-MM-DD)" # So we only need to find a released section to start printing in the awk script below @@ -154,6 +163,7 @@ jobs: CHART: ${{ needs.get-chart.outputs.chart }} run: | exit_code=0 + cd ~/charts echo "Validating README.md for bitnami/${CHART}" # Validating *.registry parameters while read line; do @@ -200,6 +210,7 @@ jobs: CHART: ${{ needs.get-chart.outputs.chart }} run: | # Updating CRDs stored at 'bitnami/$CHART/crds' and 'bitnami/$CHART/templates/crds' + cd ~/charts mapfile -t crd_files < <(find "bitnami/${CHART}/crds" "bitnami/${CHART}/templates/crds" -name "*.yaml" -o -name "*.yml" 2>/dev/null || true) for file in "${crd_files[@]}"; do # Automatically update CRDs that use the '# Source' header @@ -280,6 +291,7 @@ jobs: - id: update-pr name: Push changes run: | + cd ~/charts # Push all the new commits, if any if [[ $(git cherry -v) ]]; then git push