From 112096f1b8f7a8127fa2f64b51b26032a42f66ed Mon Sep 17 00:00:00 2001 From: Andreas Thaler Date: Tue, 23 Jan 2024 13:29:44 +0100 Subject: [PATCH] chore: Switch to stale bot (#742) --- .github/stale.yml | 19 ----- ...integration.yml => branch-integration.yml} | 0 .github/workflows/periodic-github-checks.yaml | 31 +++++++ ...ull-code-checks.yml => pr-code-checks.yml} | 0 ...ull-docu-checks.yml => pr-docu-checks.yml} | 0 ...github-checks.yml => pr-github-checks.yml} | 0 ...ull-integration.yml => pr-integration.yml} | 0 .github/workflows/pr-lifecycle.yml | 85 +++++++++++++++++++ .github/workflows/slack-message.json | 2 +- .../{post-release.yml => tag-release.yml} | 2 +- 10 files changed, 118 insertions(+), 21 deletions(-) delete mode 100644 .github/stale.yml rename .github/workflows/{post-integration.yml => branch-integration.yml} (100%) create mode 100644 .github/workflows/periodic-github-checks.yaml rename .github/workflows/{pull-code-checks.yml => pr-code-checks.yml} (100%) rename .github/workflows/{pull-docu-checks.yml => pr-docu-checks.yml} (100%) rename .github/workflows/{pull-github-checks.yml => pr-github-checks.yml} (100%) rename .github/workflows/{pull-integration.yml => pr-integration.yml} (100%) create mode 100644 .github/workflows/pr-lifecycle.yml rename .github/workflows/{post-release.yml => tag-release.yml} (98%) diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index b70d9bad4..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Label to use when marking an issue as stale -staleLabel: lifecycle/stale -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - lifecycle/frozen - - lifecycle/active -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: | - This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. - Thank you for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: | - This issue has been automatically closed due to the lack of recent activity. - /lifecycle rotten - diff --git a/.github/workflows/post-integration.yml b/.github/workflows/branch-integration.yml similarity index 100% rename from .github/workflows/post-integration.yml rename to .github/workflows/branch-integration.yml diff --git a/.github/workflows/periodic-github-checks.yaml b/.github/workflows/periodic-github-checks.yaml new file mode 100644 index 000000000..f74f1e414 --- /dev/null +++ b/.github/workflows/periodic-github-checks.yaml @@ -0,0 +1,31 @@ +name: 'Periodic Github Checks' + +on: + schedule: + - cron: '0 0 * * *' # Runs daily at midnight + workflow_dispatch: # Allows manual triggering of the workflow + +jobs: + stale-issues: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + days-before-stale: 60 + days-before-close: 7 + stale-issue-label: 'lifecycle/stale' + stale-pr-label: 'lifecycle/stale' + exempt-issue-labels: 'lifecycle/frozen' + exempt-pr-labels: 'lifecycle/frozen' + stale-issue-message: | + This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. + Thank you for your contributions. + stale-pr-message: | + This pull request has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. + Thank you for your contributions. + close-issue-message: | + This issue has been automatically closed due to the lack of recent activity. + /lifecycle rotten + close-pr-message: | + This pull request has been automatically closed due to the lack of recent activity. + /lifecycle rotten diff --git a/.github/workflows/pull-code-checks.yml b/.github/workflows/pr-code-checks.yml similarity index 100% rename from .github/workflows/pull-code-checks.yml rename to .github/workflows/pr-code-checks.yml diff --git a/.github/workflows/pull-docu-checks.yml b/.github/workflows/pr-docu-checks.yml similarity index 100% rename from .github/workflows/pull-docu-checks.yml rename to .github/workflows/pr-docu-checks.yml diff --git a/.github/workflows/pull-github-checks.yml b/.github/workflows/pr-github-checks.yml similarity index 100% rename from .github/workflows/pull-github-checks.yml rename to .github/workflows/pr-github-checks.yml diff --git a/.github/workflows/pull-integration.yml b/.github/workflows/pr-integration.yml similarity index 100% rename from .github/workflows/pull-integration.yml rename to .github/workflows/pr-integration.yml diff --git a/.github/workflows/pr-lifecycle.yml b/.github/workflows/pr-lifecycle.yml new file mode 100644 index 000000000..bf35178f2 --- /dev/null +++ b/.github/workflows/pr-lifecycle.yml @@ -0,0 +1,85 @@ +name: PR Lifecycle + +on: + pull_request: + branches: + - "main" + - "release-*" + paths-ignore: + - 'docs/**' + - '**.md' + workflow_dispatch: + +jobs: + manager-upgrade: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Golang + uses: "./.github/template/setup-golang" + + - name: Provision K3D + shell: bash + run: make provision-k3d + + - name: Deploy with latest tag + shell: bash + run: | + git fetch --tags + LATEST_TAG=$(git tag --sort=-creatordate | sed -n 1p) + echo "Using tag ${LATEST_TAG}" + git checkout ${LATEST_TAG} + GIT_COMMIT_SHA=$(git rev-parse --short=8 HEAD) + GIT_COMMIT_DATE=$(git show -s --format=%cd --date=format:'v%Y%m%d' ${GIT_COMMIT_SHA}) + echo "Deploying Manager using image europe-docker.pkg.dev/kyma-project/prod/telemetry-manager:${GIT_COMMIT_DATE}-${GIT_COMMIT_SHA}" + IMG=europe-docker.pkg.dev/kyma-project/prod/telemetry-manager:${GIT_COMMIT_DATE}-${GIT_COMMIT_SHA} make deploy-dev + + - name: Switch back to current revision + uses: actions/checkout@v4 + + - name: Wait for operator readiness + shell: bash + run: kubectl -n kyma-system rollout status deployment telemetry-operator --timeout=90s + + - name: Run test on latest tag + shell: bash + run: make run-upgrade-test + + - name: Wait for cleanup of test run + shell: bash + run: hack/wait-for-namespaces.sh + + # wait for the build to succeed so that the manager image is available + - name: Wait for the 'pull-telemetry-manager-build' job to succeed + uses: kyma-project/wait-for-commit-status-action@2b3ffe09af8b6f40e1213d5fb7f91a7bd41ffb20 + with: + context: "pull-telemetry-manager-build" + commit_ref: "${{ github.event.pull_request.head.sha }}" # Note: 'github.event.pull_request.head.sha' is not same as 'github.sha' on pull requests. + timeout: 600000 # 10 minutes in milliseconds + # The check interval is kept long otherwise it will exhaust the GitHub rate limit (More info: https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting) + check_interval: 60000 # 1 minute in milliseconds + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_OWNER: "${{ github.repository_owner }}" + GITHUB_REPO: "telemetry-manager" + + - name: Deploy with current version + shell: bash + run: | + IMG=europe-docker.pkg.dev/kyma-project/dev/telemetry-manager:PR-${{ github.event.number }} make deploy-dev + + - name: Wait for operator readiness + shell: bash + run: kubectl -n kyma-system rollout status deployment telemetry-operator --timeout=90s + + - name: Run test on current version + shell: bash + run: make run-upgrade-test + + - name: Finalize test + uses: "./.github/template/finalize-test" + if: success() || failure() + with: + failure: failure() diff --git a/.github/workflows/slack-message.json b/.github/workflows/slack-message.json index f7b080b19..5dcbdd6b4 100644 --- a/.github/workflows/slack-message.json +++ b/.github/workflows/slack-message.json @@ -1,3 +1,3 @@ { - "text": "'${{ github.workflow }}' workflow failed on '${{ env.DEFAULT_BRANCH }}' branch in the '${{ github.event.repository.name }}' repository!" + "text": "'${{ github.workflow }}' workflow failed, see https://github.com/kyma-project/telemetry-manager/actions" } \ No newline at end of file diff --git a/.github/workflows/post-release.yml b/.github/workflows/tag-release.yml similarity index 98% rename from .github/workflows/post-release.yml rename to .github/workflows/tag-release.yml index 81288ddf1..019883293 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/tag-release.yml @@ -1,4 +1,4 @@ -name: GitHub Release +name: Tag Release on: push: