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

* PRs created by bitnami-bot will be handled by triage workflow to include it in the support project (at the moment in bitnami column) and set the 'auto-merge' label, without assigning people to work on it

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

* Remove concurrency config from triage workflow. It doesn't make sense because only have one job and all steps are sequential

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

* Remove unnecessary code from move-closed-issues workflow

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

* Add 'permissions' section to stale workflow

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

* Remove labeling from comments workflow and delegate it to moving-cards workflow

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

* Remove assignments and labeling from CI workflow

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

* Change moving-cards.yml workflow to listen created task event

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

* Apply suggestions

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

* Apply suggestions

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

* Include new 'automated' label form bitnami-bot PRs

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-15 13:39:38 +02:00 committed by GitHub
parent b36f803849
commit 13f4e46d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 101 additions and 128 deletions

View File

@ -2,7 +2,6 @@ name: '[CI/CD] CI Pipeline'
on: # rebuild any PRs and main branch changes
pull_request_target:
types:
- opened
- synchronize
- labeled
branches:
@ -16,30 +15,14 @@ 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.actor == 'bitnami-bot'
steps:
# Enables auto-merge and adds necessary labels for automated releases' PRs
- id: labeling
name: Label PR
uses: andymckay/labeler@1.0.4
with:
add-labels: "verify, auto-merge"
get-containers:
runs-on: ubuntu-latest
name: Get modified containers
if: |
github.event.pull_request.state != 'closed' &&
(
(contains(github.event.pull_request.title, 'Release') && github.actor == 'bitnami-bot') ||
(
(github.event.action == 'labeled' && github.event.label.name == 'verify') ||
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'verify'))
)
(github.event.action == 'labeled' && github.event.label.name == 'verify') ||
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'verify'))
)
outputs:
result: ${{ steps.get-containers.outputs.result }}
@ -95,7 +78,7 @@ jobs:
if [[ -d "${{ matrix.container }}" ]]; then
name="$(echo "${{ matrix.container }}" | awk -F '/' '{print $2}')"
tag=""
if [[ "${{ github.actor }}" == "bitnami-bot" ]]; then
if [[ "${{ github.event.pull_request.user.login }}" == "bitnami-bot" ]]; then
tag="$(grep -oE "org.opencontainers.image.ref.name=\".+\"" ${{ matrix.container }}/Dockerfile | sed -nr "s|org.opencontainers.image.ref.name=\"(.+)\"|\1|p")"
else
# Build a tag based on current RUN number
@ -158,8 +141,7 @@ jobs:
needs: verification-summary
if: |
always() &&
contains(github.event.pull_request.title, 'Release') &&
github.actor == 'bitnami-bot'
github.event.pull_request.user.login == 'bitnami-bot'
steps:
- name: Enable auto-merge feature
if: ${{ needs.verification-summary.result == 'success' }}
@ -178,21 +160,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: Remove Automerge label
if: ${{ needs.verification-summary.result != 'success' }}
uses: andymckay/labeler@1.0.4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
remove-labels: auto-merge
- name: Send to the board
if: ${{ needs.verification-summary.result != 'success' }}
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: From Bitnami
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
issue-number: ${{ github.event.number }}
Please check the related [action_run#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more information.

View File

@ -8,14 +8,8 @@ permissions:
issues: write
pull-requests: 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,32 +20,32 @@ jobs:
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
- name: Move into From Bitnami
uses: peter-evans/create-or-update-project-card@v2
if: ${{ github.actor == 'bitnami-bot' }}
with:
project-name: Support
column-name: From Bitnami
# Required to trigger moving-cards.yml workflow (clean labels and assign people to work on it)
# NOTE: we will need to change it when the new column for failed automated PRs is created
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' && (!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' && 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' && ((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:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "triage"
remove-labels: "solved"
# Needs reasignation of the task
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"

View File

@ -6,41 +6,14 @@ on:
pull_request_target:
types:
- closed
permissions:
issues: write
repository-projects: write
pull-requests: 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:
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'
token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
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:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "solved"
remove-labels: "in-progress, on-hold, triage"
issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}

View File

@ -3,6 +3,7 @@ name: '[Support] Cards movements'
on:
project_card:
types:
- created
- moved
permissions:
@ -10,14 +11,33 @@ permissions:
issues: write
pull-requests: write
# To fix the concurrency when for example more than one label is added
concurrency:
group: ${{ github.run_id }}
cancel-in-progress: false
jobs:
get-issue:
runs-on: ubuntu-latest
name: Get issue info
outputs:
assignees: ${{ steps.get-issue-step.outputs.assignees }}
creator: ${{ steps.get-issue-step.outputs.creator }}
type: ${{ steps.get-issue-step.outputs.type }}
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')"
creator="$(echo $issue_info | jq -r '.user.login')"
pull_request="$(echo $issue_info | jq -r '.pull_request' | )"
type="pull_request"
if [[ "${pull_request}" == "null" ]]; then
type="issue"
fi
echo "::set-output name=assignees::${assignees}"
echo "::set-output name=creator::${creator}"
echo "::set-output name=type::${type}"
label-card:
runs-on: ubuntu-latest
needs:
- get-issue
steps:
- name: Repo checkout
uses: actions/checkout@v3
@ -28,32 +48,58 @@ 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: ${{ (needs.get-issue.outputs.creator == 'bitnami-bot' && needs.get-issue.outputs.type != 'issue') && 'automated, auto-merge' || 'triage' }}
remove-labels: "on-hold, in-progress, solved"
- name: Triage labeling - verify
# Only if moved into triage, the creator is bitnami-bot and it is a PR
if: |
github.event.project_card.column_id == env.TRIAGE_COLUMN_ID &&
needs.get-issue.outputs.creator == 'bitnami-bot' && needs.get-issue.outputs.type != 'issue'
uses: andymckay/labeler@1.0.4
with:
add-labels: verify
# Required to trigger CI workflow
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
- name: From Bitnami labeling
# NOTE: This step has to be modified when a new column for automated PR is added
if: ${{ github.event.project_card.column_id == env.BITNAMI_COLUMN_ID }}
uses: andymckay/labeler@1.0.4
with:
add-labels: ${{ needs.get-issue.outputs.creator == 'bitnami-bot' && 'review-required' || 'bitnami' }}
remove-labels: ${{ needs.get-issue.outputs.creator == 'bitnami-bot' && 'auto-merge' || 'on-hold, in-progress, solved' }}
- 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:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "on-hold"
remove-labels: "triage"
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:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "in-progress"
remove-labels: "on-hold, triage"
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 creator is not bitnami-bot
if: |
github.event.project_card.column_id == env.SOLVED_COLUMN_ID &&
(needs.get-issue.outputs.creator != 'bitnami-bot')
uses: andymckay/labeler@1.0.4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: "solved"
remove-labels: "in-progress, on-hold, triage"
assign-assignee-if-needed:
runs-on: ubuntu-latest
needs:
- get-issue
if: ${{ needs.get-issue.outputs.creator != 'bitnami-bot' }}
steps:
- name: Repo checkout
uses: actions/checkout@v3
@ -63,9 +109,21 @@ jobs:
uses: xom9ikk/dotenv@v1.0.2
with:
path: .github/workflows/
# NOTE: The assignment rules has to be changed when the new column for automated PR is added
- 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: ${{ 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 || 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

View File

@ -3,6 +3,10 @@ on:
schedule:
- cron: '0 1 * * *'
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest

View File

@ -9,20 +9,9 @@ on:
types:
- reopened
- opened
permissions:
repository-projects: write
issues: write
pull-requests: 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,12 @@ 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
teams: ${{ env.TRIAGE_TEAM_NAME }}
repo-token: "${{ secrets.BITNAMI_BOT_TOKEN }}"
- 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' }}
# NOTE: This step has to be modified when the new column for automated PR is added
column-name: ${{ (github.actor == 'bitnami-bot' || (!contains(fromJson(env.BITNAMI_TEAM), github.actor))) && 'Triage' || 'From Bitnami' }}
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:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
add-labels: ${{ (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) && 'triage' || 'bitnami' }}
# For reopened issues
remove-labels: "solved"
issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}