[bitnami/*] Split workflow responsibilites (#12622)

* [bitnami/*] Split workflow responsibilities

Signed-off-by: Fran Mulero <fmulero@vmware.com>

* [bitnami/*] Split workflow responsibilities

Signed-off-by: Fran Mulero <fmulero@vmware.com>

* Build Maintenance colummn configured

Signed-off-by: Fran Mulero <fmulero@vmware.com>

* Amend README badge

Signed-off-by: Fran Mulero <fmulero@vmware.com>

* Set BITNAMI_BOT_TOKEN to trigger comment action

Signed-off-by: Fran Mulero <fmulero@vmware.com>

Signed-off-by: Fran Mulero <fmulero@vmware.com>
This commit is contained in:
Fran Mulero
2022-09-22 15:53:19 +02:00
committed by GitHub
parent a4bf037707
commit 0248b4b93f
11 changed files with 132 additions and 143 deletions
+2
View File
@@ -5,5 +5,7 @@ SOLVED_COLUMN_ID=19057379
ON_HOLD_COLUMN_ID=19057378
BITNAMI_COLUMN_ID=19057375
PENDING_COLUMN_ID=19057377
BUILD_MAINTENANCE_COLUMN_ID=19174507
SUPPORT_TEAM_NAME='charts-support'
TRIAGE_TEAM_NAME='charts-triage'
BUILD_MAINTAINERS_TEAM_NAME='build-maintainers'
@@ -14,20 +14,6 @@ env:
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
VIB_PUBLIC_URL: https://cp.bromelia.vmware.com
jobs:
auto-pr-triage:
runs-on: ubuntu-latest
name: Triage for automated PRs
if: |
contains(github.event.pull_request.title, 'Release') &&
github.event.action == 'opened' &&
github.actor == 'bitnami-bot'
steps:
# Adds 'verify' label to indicate the VIB Verify job can be executed
- name: Label PR to be verified
uses: andymckay/labeler@1.0.4
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
add-labels: 'verify'
get-chart:
runs-on: ubuntu-latest
name: Get modified charts
@@ -135,21 +121,17 @@ jobs:
# not taking into account whether 'VIB Verify' succeeded
if: |
always() &&
needs.auto-pr-triage.result == 'success'
contains(github.event.pull_request.labels.*.name, 'auto-merge') &&
github.event.pull_request.user.login == 'bitnami-bot'
steps:
- name: Enable auto-merge feature
if: ${{ needs.vib-verify.result == 'success' }}
uses: reitermarkus/automerge@v2.1.2
with:
# Necessary to trigger CD workflow
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
merge-method: squash
pull-request: ${{ github.event.number }}
- name: Label PR as auto-merge
if: ${{ needs.vib-verify.result == 'success' }}
uses: andymckay/labeler@1.0.4
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
add-labels: 'auto-merge'
# Approve the CI's PR if the 'VIB Verify' job succeeded
# Approved by the 'github-actions' user; a PR can't be approved by its author
- name: PR approval
@@ -157,7 +139,6 @@ jobs:
uses: hmarr/auto-approve-action@v2.4.0
with:
pull-request-number: ${{ github.event.number }}
# If the CI did not succeed ('VIB Verify' failed or skipped),
# post a comment on the PR and assign a maintainer agent to review it
- name: Manual review required
@@ -165,21 +146,8 @@ jobs:
uses: peter-evans/create-or-update-comment@v2.0.0
with:
issue-number: ${{ github.event.number }}
# Necessary to trigger support workflows
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
body: |
There has been an error during the automated release process. Manual revision is now required.
Please check the related [action_run#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more information.
- name: Assign PR to a maintaner agent
if: ${{ needs.vib-verify.result != 'success' }}
uses: pozil/auto-assign-issue@v1.9.0
with:
numOfAssignee: 1
teams: build-maintainers
repo-token: '${{ secrets.BITNAMI_BOT_TOKEN }}'
- name: Move into From Bitnami
uses: peter-evans/create-or-update-project-card@v2.0.0
if: ${{ needs.vib-verify.result != 'success' }}
with:
project-name: Support
column-name: From Bitnami
token: '${{ secrets.GITHUB_TOKEN }}'
issue-number: ${{ github.event.number }}
+21 -26
View File
@@ -4,18 +4,11 @@ on:
types:
- created
permissions:
repository-projects: write
issues: write
pull-requests: write
repository-projects: write
# To fix the concurrency when for example more than one label is added
concurrency:
group: ${{ github.run_id }}
cancel-in-progress: false
jobs:
comments_handler:
if: ${{ github.actor != 'bitnami-bot' && ((github.event.pull_request && (!contains(github.event.pull_request.labels.*.name, 'auto-merge'))) || (github.event.issue && (!contains(github.event.issue.labels.*.name, 'auto-merge')))) }}
runs-on: ubuntu-latest
steps:
- name: Repo checkout
@@ -26,36 +19,38 @@ jobs:
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
- name: Move into From Build Maintenance
uses: peter-evans/create-or-update-project-card@v2
# The comment was created by bitnami-bot in a pull_request
if: ${{ github.actor == 'bitnami-bot' && github.event.issue.pull_request != null }}
with:
project-name: Support
column-name: Build Maintenance
# Required to trigger moving-cards.yml workflow (clean labels and assign people to work on it)
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
- name: Move into Pending
uses: peter-evans/create-or-update-project-card@v2
if: ${{ (!contains(github.event.issue.labels.*.name, 'bitnami')) && contains(fromJson(env.BITNAMI_TEAM), github.event.comment.user.login) }}
if: |
(github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) &&
(!contains(github.event.issue.labels.*.name, 'bitnami')) && contains(fromJson(env.BITNAMI_TEAM), github.actor)
with:
project-name: Support
column-name: Pending
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Move into In Progress
uses: peter-evans/create-or-update-project-card@v2
if: ${{ contains(github.event.issue.labels.*.name, 'in-progress') && (!contains(fromJson(env.BITNAMI_TEAM), github.event.comment.user.login)) }}
if: |
(github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) &&
contains(github.event.issue.labels.*.name, 'in-progress') && (!contains(fromJson(env.BITNAMI_TEAM), github.actor))
with:
project-name: Support
column-name: In progress
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Move into Triage
uses: peter-evans/create-or-update-project-card@v2
if: ${{ ((contains(github.event.issue.labels.*.name, 'triage')) || (contains(github.event.issue.labels.*.name, 'solved'))) && (!contains(fromJson(env.BITNAMI_TEAM), github.event.comment.user.login)) }}
if: |
(github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) &&
((contains(github.event.issue.labels.*.name, 'triage')) || (contains(github.event.issue.labels.*.name, 'solved'))) && (!contains(fromJson(env.BITNAMI_TEAM), github.actor))
with:
project-name: Support
column-name: Triage
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Label as triage back
# Only if commented when solved
if: ${{ contains(github.event.issue.labels.*.name, 'solved') }}
uses: andymckay/labeler@1.0.4
with:
add-labels: "triage"
remove-labels: "solved"
- name: Removing the stale label
if: ${{ contains(github.event.issue.labels.*.name, 'stale') }}
uses: andymckay/labeler@1.0.4
with:
remove-labels: "stale"
# Needs reasignation of the task
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
+2 -28
View File
@@ -6,40 +6,14 @@ on:
pull_request_target:
types:
- closed
permissions:
issues: write
pull-requests: write
repository-projects: write
# To fix the concurrency when for example more than one label is added
concurrency:
group: ${{ github.run_id }}
cancel-in-progress: false
jobs:
send_to_solved:
if: ${{ github.actor != 'bitnami-bot' || (github.actor == 'bitnami-bot' && github.event.issue && (!contains(github.event.issue.labels.*.name, 'stale'))) }}
runs-on: ubuntu-latest
steps:
- name: Repo checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Load .env file
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
- name: Send to the Solved column
uses: peter-evans/create-or-update-project-card@v2
with:
project-name: Support
# If the author comes from Bitnami, send it to Bitnami. Otherwise, all to Triage
column-name: 'Solved'
issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}
- name: Solved labeling
# Only if moved into Solved
uses: andymckay/labeler@1.0.4
with:
add-labels: "solved"
remove-labels: "in-progress, on-hold, triage"
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}
+89 -22
View File
@@ -3,22 +3,41 @@ name: '[Support] Cards movements'
on:
project_card:
types:
- created
- moved
permissions:
issues: write
pull-requests: write
repository-projects: read
# To fix the concurrency when for example more than one label is added
concurrency:
group: ${{ github.run_id }}
cancel-in-progress: false
jobs:
label-card:
if: ${{ github.actor != 'bitnami-bot' }}
get-issue:
runs-on: ubuntu-latest
name: Get issue info
outputs:
assignees: ${{ steps.get-issue-step.outputs.assignees }}
author: ${{ steps.get-issue-step.outputs.author }}
type: ${{ steps.get-issue-step.outputs.type }}
draft: ${{ steps.get-issue-step.outputs.draft }}
steps:
- name: Get issue info
id: get-issue-step
run: |
issue_info=$(curl -s --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X GET -G "${{ github.event.project_card.content_url }}" )
assignees="$(echo $issue_info | jq -r '.assignees')"
author="$(echo $issue_info | jq -r '.user.login')"
pull_request="$(echo $issue_info | jq -r '.pull_request')"
draft="$(echo $issue_info | jq -r '.draft' | sed -r "s|null|false|g")"
type="pull_request"
if [[ "${pull_request}" == "null" ]]; then
type="issue"
fi
echo "::set-output name=assignees::${assignees}"
echo "::set-output name=author::${author}"
echo "::set-output name=type::${type}"
echo "::set-output name=draft::${draft}"
label-card:
runs-on: ubuntu-latest
needs:
- get-issue
steps:
- name: Repo checkout
uses: actions/checkout@v3
@@ -29,30 +48,67 @@ jobs:
with:
path: .github/workflows/
# Now handling the needed labeling
- name: Triage labeling
# Only if moved into triage
if: ${{ github.event.project_card.column_id == env.TRIAGE_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: triage
remove-labels: on-hold, in-progress, solved
- name: From Bitnami labeling
if: ${{ github.event.project_card.column_id == env.BITNAMI_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: ${{ (needs.get-issue.outputs.author == 'bitnami-bot' && needs.get-issue.outputs.type == 'pull_request') && 'automated, auto-merge' || 'bitnami' }}
remove-labels: on-hold, in-progress, triage, solved
- name: Verify labeling
# Only if moved into bitnami column and the PR is ready for review
if: |
github.event.project_card.column_id == env.BITNAMI_COLUMN_ID &&
needs.get-issue.outputs.type == 'pull_request' && needs.get-issue.outputs.draft == 'false'
uses: andymckay/labeler@1.0.4
with:
add-labels: verify
# Required to trigger CI workflow
repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }}
- name: Build Maintenance labeling
if: ${{ github.event.project_card.column_id == env.BUILD_MAINTENANCE_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: review-required
remove-labels: auto-merge
- name: On hold labeling
# Only if moved into on hold
if: ${{ github.event.project_card.column_id == env.ON_HOLD_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: "on-hold"
remove-labels: "triage"
add-labels: on-hold
remove-labels: triage, in-progress, solved
- name: In progress labeling
# Only if moved into In progress
if: ${{ github.event.project_card.column_id == env.IN_PROGRESS_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: "in-progress"
remove-labels: "on-hold, triage"
add-labels: in-progress
remove-labels: on-hold, triage, solved
- name: Solved labeling
# Only if moved into Solved
if: ${{ github.event.project_card.column_id == env.SOLVED_COLUMN_ID }}
# Only if moved into Solved and the issue author is not bitnami-bot
if: |
github.event.project_card.column_id == env.SOLVED_COLUMN_ID &&
(needs.get-issue.outputs.author != 'bitnami-bot')
uses: andymckay/labeler@1.0.4
with:
add-labels: "solved"
remove-labels: "in-progress, on-hold, triage"
add-labels: solved
# Triage is not on the list to know how many issues/PRs are solved
# directly on triage
remove-labels: in-progress, on-hold
assign-assignee-if-needed:
if: ${{ github.actor != 'bitnami-bot' && (!contains(github.event.issue.labels.*.name, 'auto-merge')) }}
runs-on: ubuntu-latest
needs:
- get-issue
# The job shouldn't run for solved cards or new PRs created by bitnami-bot
if: |
(github.event.action != 'created' || needs.get-issue.outputs.type != 'pull_request' || needs.get-issue.outputs.author != 'bitnami-bot')
steps:
- name: Repo checkout
uses: actions/checkout@v3
@@ -63,11 +119,22 @@ jobs:
with:
path: .github/workflows/
- name: Assign to a person to work on it
# Only if moved into In progress FROM Triage
if: ${{ github.event.project_card.column_id == env.IN_PROGRESS_COLUMN_ID && github.event.changes != null && github.event.changes.column_id && github.event.changes.column_id.from == env.TRIAGE_COLUMN_ID }}
# Assign when there is nobody assigned or the card is new
if: ${{ github.event.project_card.column_id != env.SOLVED_COLUMN_ID && (needs.get-issue.outputs.assignees == '[]' || github.event.action == 'created') }}
uses: pozil/auto-assign-issue@v1.9.0
with:
numOfAssignee: 1
teams: ${{ github.event.project_card.column_id == env.BITNAMI_COLUMN_ID && env.SUPPORT_TEAM_NAME || (github.event.project_card.column_id == env.BUILD_MAINTENANCE_COLUMN_ID && env.BUILD_MAINTAINERS_TEAM_NAME || env.TRIAGE_TEAM_NAME) }}
repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }}
- name: Reassign when moved into 'In progress' from 'Triage'
# Reassigned when moved into In progress FROM Triage
if: |
github.event.action == 'moved' && needs.get-issue.outputs.assignees != '[]' &&
github.event.project_card.column_id == env.IN_PROGRESS_COLUMN_ID &&
github.event.changes.column_id.from == env.TRIAGE_COLUMN_ID
uses: pozil/auto-assign-issue@v1.9.0
with:
numOfAssignee: 1
removePreviousAssignees: true
teams: ${{ env.SUPPORT_TEAM_NAME }}
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }}
+3 -1
View File
@@ -2,7 +2,9 @@ name: '[Support] Close stale issues and PRs'
on:
schedule:
- cron: '0 1 * * *'
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest
+9 -28
View File
@@ -9,20 +9,9 @@ on:
types:
- reopened
- opened
permissions:
issues: write
pull-requests: write
repository-projects: write
# To fix the concurrency when for example more than one label is added
concurrency:
group: ${{ github.run_id }}
cancel-in-progress: false
jobs:
# For any opened or reopened issue, should be sent into Triage
send_to_board:
if: ${{ github.actor != 'bitnami-bot' }}
runs-on: ubuntu-latest
steps:
- name: Repo checkout
@@ -33,26 +22,18 @@ jobs:
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
- name: Assign to a person to work on it
uses: pozil/auto-assign-issue@v1.9.0
with:
numOfAssignee: 1
removePreviousAssignees: false
# If it's an internal issue, assign directly to the support team. Otherwise, to the triage one.
teams: ${{ (contains(fromJson(env.BITNAMI_TEAM), github.actor)) && env.SUPPORT_TEAM_NAME || env.TRIAGE_TEAM_NAME }}
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
- name: Get author
id: get-issue
run: |
author="${{ github.event.issue != null && github.event.issue.user.login || github.event.pull_request.user.login }}"
number="${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}"
echo "::set-output name=author::${author}"
echo "::set-output name=number::${number}"
- name: Send to the board
uses: peter-evans/create-or-update-project-card@v2
with:
project-name: Support
# If the author comes from Bitnami, send it to Bitnami. Otherwise, all to Triage
column-name: ${{ (contains(fromJson(env.BITNAMI_TEAM), github.actor)) && 'From Bitnami' || 'Triage' }}
column-name: ${{ (contains(fromJson(env.BITNAMI_TEAM), steps.get-issue.outputs.author)) && 'From Bitnami' || 'Triage' }}
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}
- name: Triage labeling
# Only if moved into Solved
uses: andymckay/labeler@1.0.4
with:
add-labels: ${{ (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) && 'triage' || 'bitnami' }}
# For reopened issues
remove-labels: "solved"
issue-number: ${{ steps.get-issue.outputs.number }}
+1 -1
View File
@@ -1,5 +1,5 @@
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/bitnami)](https://artifacthub.io/packages/search?repo=bitnami)
[![CD Pipeline](https://github.com/bitnami/charts/actions/workflows/cd-pipeline.yaml/badge.svg)](https://github.com/bitnami/charts/actions/workflows/cd-pipeline.yaml)
[![CD Pipeline](https://github.com/bitnami/charts/actions/workflows/cd-pipeline.yml/badge.svg)](https://github.com/bitnami/charts/actions/workflows/cd-pipeline.yml)
# The Bitnami Library for Kubernetes