Skip to content

Commit b761dcf

Browse files
MSeveyrootulptzdybalevan-forbesrach-id
authored
Celestia updates (#8)
* first commit * .github: add actions, workflows, and issue template directories * .github: added composite actions and CI Release workflow Brought in a few helpful github actions, for Yamllint, dockerfile linting, release, and versioning. * fix(.github): switch changes to only run on schedule * .github: include workflow dispatch in if condition for changes * fix(.github): fix permission issue with add write-all permission for release * .github: add markdown-lint action and remove scheduled run (#2) * Create CONTRIBUTING.md * .github: add team leads as codeowners (#9) * .github: allow for custom failure threshold for dockerfile linting (#8) * .github: update markdown-lint action to include link checker and add stale workflow (#3) * Create PR template (#12) Co-authored-by: Rootul P <rootulp@gmail.com> Co-authored-by: Tomasz Zdybał <tomek@zdybal.lap.pl> * chore: remove redundant title (#14) * fix: typo apprioprate -> appropriate (#18) * .github: create reuseable housekeeping workflow (#16) * .github: update housekeeping workflow to use pull_request_target (#20) * Create SECURITY.md (#21) * Add dependabot and bump python setup action (#22) * SECURITY: update from celestia program to security program owner (#23) * feat: Increase the yaml linter length line to 120 (#28) * Bump actions/stale from 6 to 7 (#27) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/add-to-project from 0.3.0 to 0.4.0 (#26) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump hadolint/hadolint-action from 2.1.0 to 3.1.0 (#25) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump necojackarc/auto-request-review from 0.8.0 to 0.10.0 (#24) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat: Common Docker CI pipeline (#29) * Bump docker/build-push-action from 3 to 4 (#30) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: update codeowners (#31) * fix: repositories naming (#33) * feat: Add master to publish (#34) * fix: Specify Dockerfile path in docker security (#35) * feat: Admit new input: packageName (#36) Co-authored-by: Nguyen Nhu Viet <braveryandglory@gmail.com> * chore(deps): bump actions/add-to-project from 0.4.0 to 0.4.1 (#38) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * .github: add further distinction for codeowners to improve code review (#41) * feat: build container with matrix, it might speed up the process (#43) * fix: fix name of matrics variable (#45) Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> * fix: undo matrix (#47) * copy over adr template (#40) * chore(deps): bump actions/stale from 7 to 8 (#42) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump actions/add-to-project from 0.4.1 to 0.5.0 (#55) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add repository dispatch reusable workflow (#46) Co-authored-by: Nguyen Nhu Viet <braveryandglory@gmail.com> * feat: TestGround GA (#57) * SECURITY: minor update to scope language (#48) * feat: speed up amd64 availability & push amd64 on each commit (#60) Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> * chore(deps): bump necojackarc/auto-request-review from 0.10.0 to 0.12.0 (#61) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Remove failing docker publish line (#62) * feat: use context - seems like it fixes the ldflags issue (#65) Signed-off-by: Jose Ramon Mañes <jose@celestia.org> * Revert "Remove failing docker publish line" (#64) * remove unneeded workflow and update celestia reference --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> Signed-off-by: Jose Ramon Mañes <jose@celestia.org> Co-authored-by: Rootul P <rootulp@gmail.com> Co-authored-by: Tomasz Zdybał <tomek@zdybal.lap.pl> Co-authored-by: Evan Forbes <42654277+evan-forbes@users.noreply.github.com> Co-authored-by: CHAMI Rachid <chamirachid1@gmail.com> Co-authored-by: Jose Ramon Mañes <32740567+jrmanes@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nguyen Nhu Viet <braveryandglory@gmail.com> Co-authored-by: Samuel Enderwitz <18609909+smuu@users.noreply.github.com>
1 parent 4405cc6 commit b761dcf

6 files changed

Lines changed: 410 additions & 13 deletions

File tree

.github/workflows/housekeeping.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Housekeeping
2+
3+
on:
4+
# triage new issues
5+
issues:
6+
types: [opened, edited]
7+
pull_request_target:
8+
9+
jobs:
10+
# calls housekeeping for issues
11+
# In this example, we are adding `needs: triage` label to all newly created
12+
# and unlabeled issues. Additionally, the section that is commented out would
13+
# be adding all issues to the defined project
14+
issues:
15+
name: Issue Management
16+
if: ${{ github.event_name == 'issues' }}
17+
uses: ./.github/workflows/reusable_housekeeping.yml
18+
secrets: inherit
19+
# write access for issues and pull requests is needed because the called
20+
# workflow requires write access to issues and pull requests and the
21+
# permissions must match
22+
permissions:
23+
issues: write
24+
pull-requests: write
25+
with:
26+
# Labels
27+
run-labels: true
28+
labels-to-add: "needs: triage"
29+
ignore-if-labeled: true
30+
# Projects
31+
# run-projects: true
32+
# project-url: ${{ env.PROJECT_URL }}
33+
34+
# This illustrates how to only trigger on issues with `EPIC` in the title and
35+
# then add the corresponding EPIC issue to multiple projects
36+
epic_issues:
37+
name: Manage epic_issues
38+
if: contains(github.event.issue.title, 'EPIC')
39+
strategy:
40+
matrix:
41+
project_url:
42+
- "https://github.com/orgs/rollkit/projects/3"
43+
- "https://github.com/orgs/rollkit/projects/7"
44+
uses: ./.github/workflows/reusable_housekeeping.yml
45+
secrets: inherit
46+
permissions:
47+
issues: write
48+
pull-requests: write
49+
with:
50+
# Projects
51+
run-projects: true
52+
project-url: ${{ matrix.project_url }}
53+
54+
# calls housekeeping for PRs
55+
# In this example, we are adding PRs with the `project` label to the defined
56+
# project board. Additionally we are using the custom PR assignment rules
57+
# defined in `.github/auto_request_review.yml`.
58+
pull_request:
59+
name: PR Management
60+
if: ${{ github.event_name == 'pull_request' }}
61+
uses: ./.github/workflows/reusable_housekeeping.yml
62+
secrets: inherit
63+
permissions:
64+
issues: write
65+
pull-requests: write
66+
with:
67+
# Projects
68+
run-projects: true
69+
project-url: "https://github.com/orgs/rollkit/projects/7"
70+
project-labels: "project"
71+
# Reviewers
72+
run-auto-request-review: true

.github/workflows/reusable_dockerfile_pipeline.yml

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }}
6767
OUTPUT_IMAGE_NAME: ${{ needs.prepare-env.outputs.output_image_name }}
6868
with:
69+
context: .
6970
push: false
7071
platforms: linux/amd64
7172
# we're building the container before the scan, use the short sha tag
@@ -82,12 +83,12 @@ jobs:
8283
OUTPUT_IMAGE_NAME: ${{ needs.prepare-env.outputs.output_image_name }}
8384
with:
8485
# here we use the local tag that we've built before
85-
image-ref: '${{ env.OUTPUT_IMAGE_NAME }}:${{ env.OUTPUT_SHORT_SHA }}'
86-
format: 'table'
86+
image-ref: "${{ env.OUTPUT_IMAGE_NAME }}:${{ env.OUTPUT_SHORT_SHA }}"
87+
format: "table"
8788
#exit-code: '1' # uncomment to stop the CI if the scanner fails
8889
ignore-unfixed: true
89-
vuln-type: 'os,library'
90-
severity: 'CRITICAL,HIGH'
90+
vuln-type: "os,library"
91+
severity: "CRITICAL,HIGH"
9192

9293
docker-build:
9394
runs-on: "ubuntu-latest"
@@ -125,7 +126,7 @@ jobs:
125126
tags: |
126127
# output minimal (short sha)
127128
type=raw,value={{sha}}
128-
# output v0.2.1/v*-*
129+
# output v0.2.1/v*-* (or sha of no tag)
129130
type=semver,pattern={{raw}}
130131
# pull request event
131132
type=ref,enable=true,prefix=pr-,suffix=,event=pr
@@ -134,20 +135,50 @@ jobs:
134135
- name: Set up Docker Buildx
135136
uses: docker/setup-buildx-action@v2
136137

137-
# We always build the image but we only push if we are on the `main`,
138-
# `master` branch or a versioned `v*` branch
139-
- name: Build and PushDocker Image
138+
# Build amd64 images always, and publish when it is not a fork. The Github
139+
# security model prevents forks from pushing to the registry so we can
140+
# only push if the branch/PR is not generated from a fork. Even though
141+
# forks can't push, we still want to try and build the image to catch
142+
# bugs. For testing purposes we only need an amd64 image.
143+
- name: Build and Push Docker Image amd64
140144
uses: docker/build-push-action@v4
141145
env:
142146
OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }}
143147
OUTPUT_IMAGE_NAME: ${{ needs.prepare-env.outputs.output_image_name }}
144148
with:
145-
platforms: linux/amd64,linux/arm64
149+
context: .
150+
platforms: linux/amd64
151+
# Only push if the head and base repos match, meaning it is not a fork
146152
# yamllint disable
147-
# The following line, is execute as an if statement, only push when
148-
# the branch is main, master or starts with v*
149-
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
153+
push: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
150154
# yamllint enable
151155
tags: ${{ steps.meta.outputs.tags }}
152156
labels: ${{ steps.meta.outputs.labels }}
153157
file: ${{ inputs.dockerfile }}
158+
159+
# Build and Publish images on main, master, and versioned branches.
160+
#
161+
# NOTES:
162+
# This step overrides the tag from the previous step. It will re-use
163+
# the cached image that was built and only build the remaining images.
164+
#
165+
# The reason we split out these steps into 2 is for better handling of
166+
# forks when building amd64 images and to enable faster availability of
167+
# the amd64 image since building the arm64 image takes significantly
168+
# longer.
169+
- name: Build and Push Docker Images
170+
uses: docker/build-push-action@v4
171+
# yamllint disable
172+
# only run when the branch is main, master or starts with v*
173+
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
174+
# yamllint enable
175+
env:
176+
OUTPUT_SHORT_SHA: ${{ needs.prepare-env.outputs.output_short_sha }}
177+
OUTPUT_IMAGE_NAME: ${{ needs.prepare-env.outputs.output_image_name }}
178+
with:
179+
context: .
180+
platforms: linux/amd64,linux/arm64
181+
push: true
182+
tags: ${{ steps.meta.outputs.tags }}
183+
labels: ${{ steps.meta.outputs.labels }}
184+
file: ${{ inputs.dockerfile }}

.github/workflows/reusable_housekeeping.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
permissions:
100100
pull-requests: write
101101
steps:
102-
- uses: necojackarc/auto-request-review@v0.10.0
102+
- uses: necojackarc/auto-request-review@v0.12.0
103103
with:
104104
# There is a rollkit level PAT_FOR_AUTO_REQUEST_REVIEW secret that
105105
# belongs to MSevey who should have sufficient access for all public
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Repository Dispatch
2+
3+
# This workflow is used to call workflows in external repositories and bring the
4+
# result back into the calling repository.
5+
#
6+
# This is ideal for E2E testing when a repository can trigger a dependent
7+
# repository's integration tests in order to check for breaking changes.
8+
#
9+
# The called repository should have a workflow that triggers on `workflow_dispatch`
10+
#
11+
# Example:
12+
#
13+
# name: Repository Dispatch
14+
# on:
15+
# workflow_dispatch:
16+
# inputs:
17+
# distinct_id:
18+
# key:
19+
#
20+
# jobs:
21+
# test:
22+
# runs-on: ubuntu-latest
23+
# steps:
24+
# - name: echo distinct ID ${{ github.event.inputs.distinct_id }}
25+
# run: |
26+
# echo ${{ github.event.inputs.distinct_id }}
27+
# echo 'my input key ${{ inputs.key }}'
28+
#
29+
#
30+
# At a minimum a `distinct_id` input is required in the called workflow so that
31+
# this workflow can find the workflow run in the API since the `distinct_id` is
32+
# then printed in the run name. This is just needed in one step, so as a
33+
# template, the echo statement can be used for debugging purposes.
34+
#
35+
# This example also shows how you can access addition inputs via the
36+
# `workflow_inputs` variable. These `workflow_inputs` should correspond with
37+
# `workflow_dispatch` inputs. In this example, the `workflow_inputs` would have
38+
# been '{"key": "my_value"}'
39+
40+
on:
41+
workflow_call:
42+
inputs:
43+
owner:
44+
description: "Repository owner for the target repository"
45+
type: string
46+
required: true
47+
repo:
48+
description: "Repository being targeted"
49+
type: string
50+
required: true
51+
ref:
52+
description: "The branch of the target repository that should be targeted, i.e. main or refs/heads/main"
53+
type: string
54+
required: false
55+
default: main
56+
workflow:
57+
description: "The workflow in the target repository that should be triggered"
58+
type: string
59+
required: true
60+
workflow_inputs:
61+
description: "A key value map of custom inputs, i.e. `{'my_key':'my_value'}`"
62+
type: string
63+
required: false
64+
default: ""
65+
workflow_timeout_seconds:
66+
description: "Timeout for called workflow"
67+
type: number
68+
required: false
69+
default: 300
70+
71+
jobs:
72+
triggerMyEvent:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Dispatch an action and get the run ID
76+
uses: codex-/return-dispatch@v1
77+
id: return_dispatch
78+
with:
79+
token: ${{ secrets.PAT_REPO_DISPATCH }} # this is an org level secret
80+
ref: ${{inputs.repo}}
81+
repo: ${{inputs.repo}}
82+
owner: ${{inputs.owner}}
83+
workflow: ${{inputs.workflow}}
84+
workflow_inputs: ${{ inputs.workflow_inputs }} # Optional
85+
workflow_timeout_seconds: ${{inputs.workflow_timeout_seconds}} # Default: 300
86+
87+
# I added this as I observed the API response sometimes being empty as the
88+
# API route used to get the conclusion is different than the API route
89+
# used in the previous action
90+
- name: Delay for api to update
91+
run: sleep 2
92+
93+
- name: Get Conclusion
94+
uses: octokit/request-action@v2.x
95+
id: get_run_conclusion
96+
with:
97+
route: GET /repos/{owner}/{repo}/actions/runs/{run_id}
98+
owner: ${{inputs.owner}}
99+
repo: ${{inputs.repo}}
100+
run_id: ${{steps.return_dispatch.outputs.run_id}}
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
104+
- name: Fail if not successful
105+
if: ${{ fromJSON(steps.get_run_conclusion.outputs.data).conclusion != 'success' }}
106+
run: exit 1
107+
# Alternative if descriptive exit code is helpful
108+
# uses: actions/github-script@v3
109+
# with:
110+
# script: |
111+
# core.setFailed('My detailed error response')

CONTRIBUTING.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Contributing to Rollkit
2+
3+
Welcome and thank you for contributing to building Rollkit.
4+
5+
In this guide, you will find information about how the Rollkit team manages the
6+
`rollkit` Github as well as expectations around our engineering standards.
7+
8+
## Github Management
9+
10+
The `rollkit` Github uses teams to manage access to the organization and its
11+
repositories. Currently there is just one `celestia` team which is the team from
12+
Celestia that is working on Rollkit. As more teams contritube to Rollkit, more
13+
teams will be added.
14+
15+
### Permissions
16+
17+
By default, all teams have `Triage` access to all repositories in the
18+
`rollkit` Github. This allows for anyone to help manage issues and pull
19+
requests (i.e. adding labels). Teams are given write access to the repositories
20+
that they are responsible for working on.
21+
22+
### Codeowners
23+
24+
All production repos must use Codeowners or the Auto Review github workflow.
25+
Codeowners are typically the team leads and/or engineering leadership members.
26+
27+
### .github
28+
29+
The Rollkit team utilizes the organization's `.github` repository. This
30+
repository is used to store common organization level content like Github
31+
actions, issue templates, PR templates, etc.
32+
33+
### Repository Settings
34+
35+
The following is a list of key settings that should be enabled on all production
36+
repositories:
37+
38+
**Enabled:**
39+
40+
- Issues
41+
- Projects
42+
- Perserve this repository
43+
- Allow merge commits **Forked Repos Only**
44+
- Allow squash merging
45+
- Default to pull request title
46+
- Always suggest updating pull request branches
47+
- Allow auto-merge
48+
- Automatically delete head branches
49+
50+
**Disabled:**
51+
52+
- Allow merge commits **Except Forked Repos**
53+
- Allow rebase merging
54+
55+
## Development
56+
57+
### What the Fork
58+
59+
The default development flow is to fork the repository that you are working on
60+
in order to submit a PR. If you have write access to a repository, because you
61+
are a member of that sub team, then you can push your development branches
62+
directly to the repository.
63+
64+
### ADRs
65+
66+
For architectural changes or improvements, Rollkit uses Architecture Decision
67+
Record (ADRs) to flush out the design scope. These live in the code under
68+
`docs/adr`. PRs are used to open new ADRs for approval.
69+
70+
### Issues
71+
72+
When proposing new work, an issue should be created. Issues can be created for
73+
bugs, feature requests, improvements based on ADRs, etc. Issue templates should
74+
be used whenever possible, but especially for bug reports, feature requests, and
75+
ADRs to ensure all the necessary information is captured.
76+
77+
### Pull Requests
78+
79+
Before opening a PR, make sure that the scope of work was previously
80+
communicated, either via an ADR or an issue. Submitting code that has no
81+
background context is likely to be rejected because the implication and design
82+
has not been properly discussed.
83+
84+
The Rollkit team has a culture of prioritizing the review of PRs. This
85+
prioritization focuses on unblocking others and finishing existing work before
86+
starting new work.
87+
88+
As a developer, you are responsible for ensuring your code gets merged. This
89+
means you should be verifying that the appropriate reviewers are assigned and
90+
that you are responding to review comments promptly. When given the choice to
91+
start a new PR or work on closing out an existing PR, you should usually choose
92+
closing out the existing PR.
93+
94+
As a reviewer, it is your responsibility to be providing prompt, action oriented
95+
reviews. Clearing out your requests reviews should be a daily activity. Action
96+
oriented reviews mean that there is a clear action step for the developer of
97+
the PR to take in order to get the PR approved and merged. Open ended questions
98+
and statements should be avoided. Being clear when a comment is a blocking change,
99+
okay to be a follow up, or just a personal preference enables developers to
100+
effectively implement the feedback on a PR.
101+
102+
All production repos have the following branch protections requirements:
103+
104+
- 2 approvals
105+
- Codeowner approval
106+
- New commits dismiss approvals
107+
- Status checks must be passing
108+
- Conversations must be resolved

0 commit comments

Comments
 (0)