forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
celo-org/op-geth
dependencies update script and gh-action (#263)
* Add script to update `celo-org/op-geth` dependencies Signed-off-by: Maximilian Langenfeld <[email protected]> * Add github action for update-geth script Signed-off-by: Maximilian Langenfeld <[email protected]> * Use inline geth base-ref Signed-off-by: Maximilian Langenfeld <[email protected]> * Discard automatic fields Signed-off-by: Maximilian Langenfeld <[email protected]> * token perms Signed-off-by: Maximilian Langenfeld <[email protected]> * Use read-only GCP SA Signed-off-by: Maximilian Langenfeld <[email protected]> * Better parameter handling in update-geth action Signed-off-by: Maximilian Langenfeld <[email protected]> * Remove `update-celo-geth` cmd from justfile --------- Signed-off-by: Maximilian Langenfeld <[email protected]> Co-authored-by: alvarof2 <[email protected]>
- Loading branch information
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "Update celo-org/op-geth" | ||
on: | ||
schedule: | ||
- cron: "00 8 * * Mon" | ||
workflow_dispatch: | ||
|
||
env: | ||
OP_GETH_BASE_BRANCH: "celo10" | ||
|
||
jobs: | ||
job_id: | ||
# Add "id-token" with the intended permissions. | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
id-token: "write" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Login at GCP Artifact Registry | ||
uses: celo-org/reusable-workflows/.github/actions/[email protected] | ||
with: | ||
workload-id-provider: "projects/1094498259535/locations/global/workloadIdentityPools/gh-optimism-ro/providers/github-by-repos" | ||
service-account: "[email protected]" | ||
docker-gcp-registries: us-west1-docker.pkg.dev | ||
access-token-lifetime: "2m" | ||
- name: "Set up Cloud SDK" | ||
uses: "google-github-actions/setup-gcloud@v2" | ||
with: | ||
version: ">= 363.0.0" | ||
- name: Run the update-geth script | ||
id: geth-update-script | ||
run: | | ||
GETH_COMMIT=$(bash ./ops/celo/update-geth.sh "$OP_GETH_BASE_BRANCH") | ||
echo "GETH_COMMIT=${GETH_COMMIT}" >> $GITHUB_OUTPUT | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v7 | ||
env: | ||
TITLE: "[Automatic] - Update op-geth dependencies" | ||
MESSAGE: | | ||
Update the go package dependency and the devnet | ||
docker container reference of the `l2` service | ||
to the latest commit (`${{ steps.geth-update-script.outputs.GETH_COMMIT }}`) | ||
in the `${{ env.OP_GETH_BASE_BRANCH }}` ref. | ||
with: | ||
add-paths: | | ||
go.mod | ||
go.sum | ||
ops-bedrock/*.Dockerfile | ||
commit-message: | | ||
${{ env.TITLE }} | ||
${{ env.MESSAGE }} | ||
signoff: false | ||
branch: update/op-geth | ||
base: "${{ env.OP_GETH_BASE_BRANCH }}" | ||
delete-branch: true | ||
title: "${{ env.TITLE }}" | ||
body: "${{ env.MESSAGE }}" | ||
draft: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,6 @@ crytic-export | |
|
||
# vscode | ||
.vscode/ | ||
|
||
# Ignore generated credentials from google-github-actions/auth | ||
gha-creds-*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
branch="$1" | ||
if [ -z "$branch" ]; then | ||
echo "No argument given. Please supply the ref in 'celo-org/op-geth' to be used " | ||
exit 1 | ||
fi | ||
|
||
commit=$(git ls-remote https://github.com/celo-org/op-geth/ "$branch" | awk '{print $1}') | ||
if [ -z "$commit" ]; then exit 1; fi | ||
|
||
go_version=$(go list -m "github.com/celo-org/op-geth@$commit") | ||
if [ -z "$go_version" ]; then exit 1; fi | ||
|
||
sha256digest=$(gcloud --format=json artifacts files list \ | ||
--project=blockchaintestsglobaltestnet \ | ||
--repository=dev-images \ | ||
--location=us-west1 \ | ||
--package=op-geth \ | ||
--limit=1 \ | ||
--tag="$commit" | jq ".[0].name" | grep -oP "sha256:\K[0-9a-f]{64}") | ||
if [ -z "$sha256digest" ]; then exit 1; fi | ||
|
||
sed -i "s|\(.*op-geth@sha256:\)\(.*\)|\1$sha256digest|" ./ops-bedrock/l2-op-geth.Dockerfile | ||
sed -i "s|\(replace github.com/ethereum/go-ethereum => \)github.com/celo-org/op-geth v.*|\1$go_version|" go.mod | ||
|
||
go_mod_error=$(go mod tidy >/dev/null) | ||
if [ -n "$go_mod_error" ]; then | ||
echo "$go_mod_error" | ||
exit 1 | ||
fi | ||
|
||
echo "$commit" |