Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions content/pages/app-upgrade-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,41 @@ This policy encompasses Infra's approach to upgrades of Jenkins, Confluence and
## Jenkins

### Main Jenkins instance

_Upgrades once a quarter_

Infra follows the <a href="https://jenkins.io/download/lts/" target="_blank">LTS line of releases</a>, which the Jenkins Project releases on a 12-week cycle. Once every three months, on the last Saturday or Sunday of the month following the Jenkins LTS release, ASF Infra upgrades the main instance.

### Jenkins plugins

_Upgrade once a month_

We upgrade all plugins (there are more than 200!) before and after the main instance upgrade, as appropriate, and at the end of each month when there is no main instance upgrade to perform.

## Jira

### Main Jira instance

_Upgrades every six months_

Jira gets a new release every two to six weeks, far too often (and unpredictable) for us to upgrade every release they make. Infra upgrades our Jira instance to whatever the latest release is every six months.

### Jira plugins

_Upgrade every two months_

We upgrade Jira plugins before or after each main instance upgrade, as appropriate, and once every two months between main instance upgrades.

## Confluence

### Main Confluence instance

_Upgrades every six months_

Our goal is to upgrade Confluence to the latest version twice a year.

### Confluence plugins

_Upgrade every two months_

Every two months we perform upgrades to plugins that are compatible with the version of the main Confluence instance we are running.
Expand Down
50 changes: 50 additions & 0 deletions content/pages/github-actions-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Some of these techniques are experiments that Airflow is exploring. Treat them a
| [Cap open pull requests per contributor](#pr-cap) | In production | 210 PRs from 21 contributors closed in the first pass |
| [Run external contributors' CI in their forks](#fork-ci) | **Experimental** | Expected to cut shared-runner use by about 40% |
| [Self-hosted runners with RunsOn](#runs-on) | **Experimental** | Expected to move at least 40% of the heaviest jobs off shared runners |
| [Cancel the runs of merged pull requests](#cancel-merged) | **Proposed** | Stops runs that keep going after their pull request has merged |

<h3 id="basics">Start with the basics<a class="headerlink" href="#basics" title="Permanent link">&para;</a></h3>

Expand Down Expand Up @@ -189,6 +190,55 @@ RunsOn offers two modes. Fleet adds a GitHub runner group restricted to selected

Airflow references: <a href="https://cwiki.apache.org/confluence/x/-JXwGg" target="_blank">AIP-118: Self-hosted runners for Apache Airflow CI</a> and its <a href="https://cwiki.apache.org/confluence/spaces/AIRFLOW/pages/451974672/AIP-118+Appendix+%E2%80%94+evidence+and+implementation+details" target="_blank">appendix with evidence and implementation details</a>, the <a href="https://lists.apache.org/thread/t6cr2gnmnxk3pczoklm954zzy2wcn98d" target="_blank">AIP-119 discussion</a> on cost guardrails, the implementation and its security review in <a href="https://github.com/apache/airflow/pull/74889" target="_blank">apache/airflow#74889</a>, and the earlier full-CI experiment in <a href="https://github.com/apache/airflow/pull/74714" target="_blank">apache/airflow#74714</a>. See also RunsOn's own <a href="https://runs-on.com" target="_blank">documentation</a> on security for public repositories.

<h3 id="cancel-merged">Cancel the runs of merged pull requests (proposed)<a class="headerlink" href="#cancel-merged" title="Permanent link">&para;</a></h3>

**Status: proposed.** Results will be added here once it has been used in production for a while.

Merging a pull request does not stop its `pull_request` runs. A maintainer often merges as soon as the checks they need are green, while slower jobs of the same run are still queued or running. Those jobs keep holding runners for a result nobody reads, because the change is already on its target branch. A concurrency group does not help: the merge does not start a new run in the pull request's group.

A workflow triggered by `push` can cancel them. Merging pushes a commit to the target branch, so the workflow starts right after the merge, looks up the pull request of that commit and cancels its unfinished `pull_request` runs. A `push` run has a token that can write to the base repository, so it can also cancel the runs of pull requests from forks. Things to get right:

- **Match runs by the head of the pull request.** The `pull_requests` field of a run is empty when the pull request comes from a fork, so filter the runs by the head commit and head repository of the merged pull request instead.
- **Only cancel runs created before the merge.** Workflows triggered by the merge itself, for example on the `closed` event, are meant to run.
- **Skip heads that an open pull request still uses.** The same commit can be the head of another pull request, for example one that targets a different branch.
- **Force-cancel what does not stop.** A job that ignores the cancellation keeps its runner. Use the <a href="https://docs.github.com/en/rest/actions/workflow-runs#force-cancel-a-workflow-run" target="_blank">force-cancel endpoint</a> to cancel a run that continues after a normal cancel.

A minimal version, which needs write access only to `actions`. List the branches that your pull requests merge into under `branches`:

```yaml
name: Cancel the runs of merged pull requests
on:
push:
branches: [main]
permissions:
actions: write
contents: read
pull-requests: read
jobs:
cancel:
runs-on: ubuntu-slim
timeout-minutes: 5
steps:
- env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
SHA: ${{ github.sha }}
run: |
gh api "repos/$REPO/commits/$SHA/pulls" \
--jq '.[] | select(.merged_at != null) | [.head.repo.full_name, .head.sha, .merged_at] | @tsv' |
while IFS=$'\t' read -r head_repo head_sha merged_at; do
open=$(gh pr list -R "$REPO" --state open --search "$head_sha" --json headRefOid \
--jq "[.[] | select(.headRefOid == \"$head_sha\")] | length")
[[ "$open" == 0 ]] || continue
for status in queued in_progress; do
gh api --paginate "repos/$REPO/actions/runs?event=pull_request&head_sha=$head_sha&status=$status" \
--jq ".workflow_runs[] | select(.head_repository.full_name == \"$head_repo\" and .created_at < \"$merged_at\") | .id"
done | while read -r id; do
gh run cancel "$id" -R "$REPO"
done
done
```

<h3 id="magpie">Audit your workflows with Apache Magpie<a class="headerlink" href="#magpie" title="Permanent link">&para;</a></h3>

<a href="https://magpie.apache.org/" target="_blank">Apache Magpie</a> is a set of skills for the AI agent a maintainer already uses, built at the ASF for the work of running a project. Its <a href="https://github.com/apache/magpie/blob/main/docs/repo-health/README.md" target="_blank">repo-health skills</a> let a PMC audit its repositories without writing anything to them: each skill reads the repository, reports what it found, and proposes changes that the maintainers decide on.
Expand Down
Loading