Skip to content

Commit

Permalink
Upgrade CI (23 Aug 2023 08:32:49)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 23, 2023
1 parent 7b598c9 commit 444f0c3
Show file tree
Hide file tree
Showing 20 changed files with 834 additions and 363 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/command_merge.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@

on: issue_comment
name: Issue Comments
name: Issue Comments - merge
env:
OPP_PRODUCTION_TYPE: "ocp"
OPP_THIS_REPO_NAME: "okd-operators"
OPP_THIS_REPO_ORG: "redhat-openshift-ecosystem"

jobs:
handle_comments:
name: Merge command handler
name: Check comments for /merge
if: |
startsWith(github.event.comment.body, '/merge')
runs-on: ubuntu-latest
steps:

- uses: actions/github-script@v4
- uses: actions/github-script@v6
id: labels
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const labels = await github.issues.listLabelsOnIssue({
const labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.payload.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
})
console.log(labels.data)
return labels.data
# - name: Print info about event
# id: info
# continue-on-error: true
# uses: actions/github-script@v3
# with:
# github-token: ${{secrets.GITHUB_TOKEN}}
# script: |
# console.log(context)
# console.log(`::set-output name=xxx::${context.payload.issue.labels}`)

- name: Merge command handler
id: command
uses: xt0rted/slash-command-action@v1
Expand All @@ -47,7 +39,7 @@ jobs:
permission-level: write

- name: Merge message when not able to merge and inform user about authorized_changes
uses: actions/github-script@v3
uses: actions/github-script@v6
if: |
steps.command.outputs.command-name == 'merge' &&
steps.command.outputs.command-arguments == 'possible' &&
Expand All @@ -60,39 +52,39 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Current PR can be merged automatically, but there is missing `authorized-changes` label. One can find out more info [here](https://operator-framework.github.io/community-operators/operator-ci-yaml/#reviewers).'
body: 'Current PR can be merged automatically, but there is missing `authorized-changes` label. One can find out more info [here](https://${OPP_THIS_REPO_ORG}.github.io/${OPP_THIS_REPO_NAME}/operator-ci-yaml/#reviewers).'
})
- name: Message when automerge is disabled
uses: actions/github-script@v3
uses: actions/github-script@v6
if: |
steps.command.outputs.command-name == 'merge' &&
steps.command.outputs.command-arguments == 'possible' &&
(contains(fromJSON(steps.labels.outputs.result).*.name, 'automerge-disabled'))
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Automatic merge is disabled temporarily due to a maintenance.'
})
- name: Message when dco-failed is missing
uses: actions/github-script@v3
uses: actions/github-script@v6
if: |
steps.command.outputs.command-name == 'merge' &&
steps.command.outputs.command-arguments == 'possible' &&
(contains(fromJSON(steps.labels.outputs.result).*.name, 'dco-failed'))
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/command_retest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

on: issue_comment
name: Issue Comments - retest
env:
OPP_PRODUCTION_TYPE: "ocp"

jobs:
handle_comments:
name: Check comments for /retest
if: |
startsWith(github.event.comment.body, '/retest')
runs-on: ubuntu-latest
steps:
- name: Restest command handler
id: command
uses: xt0rted/slash-command-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: retest
reaction: "true"
reaction-type: "eyes"
allow-edits: "true"
permission-level: read

- name: Doing hold
uses: actions/github-script@v6
if: |
steps.command.outputs.command-name == 'retest'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '/hold'
})
- name: Sleep for 10 seconds
uses: jakejarvis/wait-action@master
with:
time: '10s'

- name: Doing hold cancel
uses: actions/github-script@v6
if: |
steps.command.outputs.command-name == 'retest'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '/hold cancel'
})
8 changes: 4 additions & 4 deletions .github/workflows/dco_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- id: files
uses: jitterbit/get-changed-files@v1
uses: masesgroup/retrieve-changed-files@v2
continue-on-error: true
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
Expand All @@ -53,7 +53,7 @@ jobs:
run: |
echo "Using script '$OPP_SCRIPT_ENV_URL' ..."
echo "global labels $OPP_LABELS"
bash <(curl -sL $OPP_SCRIPT_ENV_URL)
bash <(curl -sL $OPP_SCRIPT_ENV_URL) || true
outputs:
opp_test_ready: "${{ steps.op-traffic-light.outputs.opp_test_ready }}"
opp_release_ready: "${{ steps.op-traffic-light.outputs.opp_release_ready }}"
Expand Down
31 changes: 17 additions & 14 deletions .github/workflows/dco_workflow_complete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
uses: actions/github-script@v6
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.actions.downloadArtifact({
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
Expand All @@ -38,16 +38,17 @@ jobs:
- name: 'PR Number'
id: pr-number
run: |
PR=$(cat ./NR)
echo "::set-output name=pr::${PR}"
PR=$(tr -dc [0-9] <./NR)
[ -z "$PR" ] && echo "Invalid PR number" && exit 1
echo "pr=${PR}" >> $GITHUB_OUTPUT
- uses: actions/github-script@v4
- uses: actions/github-script@v6
id: pr-labels
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const labels = await github.issues.listLabelsOnIssue({
const labels = await github.rest.issues.listLabelsOnIssue({
issue_number: ${{ steps.pr-number.outputs.pr }},
owner: context.repo.owner,
repo: context.repo.repo
Expand All @@ -63,27 +64,29 @@ jobs:
steps:
- name: "Removing dco-failed label"
if: needs.pr.outputs.pr != '0'
uses: actions/github-script@v3
uses: actions/github-script@v6
continue-on-error: true
env:
PR: "${{ needs.pr.outputs.pr }}"
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.removeLabel({
issue_number: ${{ needs.pr.outputs.pr }},
github.rest.issues.removeLabel({
issue_number: process.env.PR,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'dco-failed'
})
# - uses: actions/github-script@v3
# - uses: actions/github-script@v6
# if: |
# (!contains(fromJson(steps.pr-labels.outputs.result).*.name, 'do-not-merge/work-in-progress')) &&
# (!contains(fromJson(steps.pr-labels.outputs.result).*.name, 'do-not-merge/hold'))
# continue-on-error: true
# with:
# github-token: ${{ secrets.FRAMEWORK_MERGE }}
# script: |
# github.issues.createComment({
# github.rest.issues.createComment({
# issue_number: ${{ needs.pr.outputs.pr }},
# owner: context.repo.owner,
# repo: context.repo.repo,
Expand All @@ -97,12 +100,12 @@ jobs:
steps:

- name: "Setting dco-failed label"
uses: actions/github-script@v3
uses: actions/github-script@v6
continue-on-error: true
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.addLabels({
github.rest.issues.addLabels({
issue_number: ${{ needs.pr.outputs.pr }},
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: "Documentation"

on:
schedule:
- cron: "0 0 * * *"
Expand All @@ -8,7 +8,8 @@ on:
number-of-prs:
description: 'Number of PRs'
required: true
default: '5000'
default: '100'

env:
OPP_THIS_REPO: "redhat-openshift-ecosystem/okd-operators"

Expand All @@ -17,16 +18,25 @@ jobs:
runs-on: ubuntu-latest
container: quay.io/operator_testing/community-operators-mkdocs
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: redhat-openshift-ecosystem/community-operators-pipeline
ref: documentation

- name: Generate docs
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPR: ${{ github.event.inputs.number-of-prs || 5000 }}
NPR: ${{ github.event.inputs.number-of-prs || 100 }}
run: |
OPP_THIS_REPO_SED="https://github.com/$OPP_THIS_REPO"
OPP_THIS_REPO_SED=${OPP_THIS_REPO_SED//\//\\/}
sed -i 's/repo_url.*/repo_url: '$OPP_THIS_REPO_SED'/g' mkdocs.yml
sed -i 's/ cluster_type:.*/ cluster_type: ocp/g' mkdocs.yml
cat mkdocs.yml
ci/operator-flow/doc.sh ${NPR} ${OPP_THIS_REPO}
mkdocs build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
Loading

0 comments on commit 444f0c3

Please sign in to comment.