Commit 03f5b550 authored by Mark Tyneway's avatar Mark Tyneway

ops: bring back scripts

Bring back `ci-builder` to the monorepo as it should have never
been deleted. Also bring back various tagging scripts. It is not
clear which tagging script is used at the moment, need clarity
on which should be actually brought back before merging this.
`ci-versions.js` is required for changesets, so bring that back
for sure. `update-op-geth.py` is used but unclear about the 2 other
shell scripts.
parent d9cf6179
FROM debian:bullseye-20220822-slim as foundry-build
SHELL ["/bin/bash", "-c"]
WORKDIR /opt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y curl build-essential git && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh && \
chmod +x ./rustup.sh && \
./rustup.sh -y
WORKDIR /opt/foundry
# Only diff from upstream docker image is this clone instead
# of COPY. We select a specific commit to use.
RUN git clone https://github.com/foundry-rs/foundry.git . \
&& git checkout da2392e58bb8a7fefeba46b40c4df1afad8ccd22
RUN source $HOME/.profile && \
cargo build --release && \
strip /opt/foundry/target/release/forge && \
strip /opt/foundry/target/release/cast && \
strip /opt/foundry/target/release/anvil
FROM ethereum/client-go:alltools-v1.10.25 as geth
FROM ghcr.io/crytic/echidna/echidna:v2.0.4 as echidna-test
FROM python:3.8.13-slim-bullseye
ENV GOPATH=/go
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH
ENV DEBIAN_FRONTEND=noninteractive
COPY --from=foundry-build /opt/foundry/target/release/forge /usr/local/bin/forge
COPY --from=foundry-build /opt/foundry/target/release/cast /usr/local/bin/cast
COPY --from=foundry-build /opt/foundry/target/release/anvil /usr/local/bin/anvil
COPY --from=geth /usr/local/bin/abigen /usr/local/bin/abigen
COPY --from=echidna-test /usr/local/bin/echidna-test /usr/local/bin/echidna-test
COPY check-changed.sh /usr/local/bin/check-changed
RUN apt-get update && \
apt-get install -y bash curl openssh-client git build-essential ca-certificates jq musl gnupg coreutils && \
curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && \
curl -sL https://go.dev/dl/go1.19.linux-amd64.tar.gz -o go1.19.linux-amd64.tar.gz && \
tar -C /usr/local/ -xzvf go1.19.linux-amd64.tar.gz && \
ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt && \
bash nodesource_setup.sh && \
apt-get install -y nodejs && \
npm i -g npm@8.11.0 \
npm i -g yarn && \
npm i -g depcheck && \
pip install slither-analyzer==0.9.1 && \
go install gotest.tools/gotestsum@latest && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.48.0 && \
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash && \
chmod +x /usr/local/bin/check-changed
RUN echo "downloading solidity compilers" && \
curl -o solc-linux-amd64-v0.5.17+commit.d19bba13 -sL https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.5.17+commit.d19bba13 && \
curl -o solc-linux-amd64-v0.8.9+commit.e5eed63a -sL https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.8.9+commit.e5eed63a && \
curl -o solc-linux-amd64-v0.8.10+commit.fc410830 -sL https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.8.10+commit.fc410830 && \
curl -o solc-linux-amd64-v0.8.12+commit.f00d7308 -sL https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.8.12+commit.f00d7308 && \
echo "verifying checksums" && \
(echo "c35ce7a4d3ffa5747c178b1e24c8541b2e5d8a82c1db3719eb4433a1f19e16f3 solc-linux-amd64-v0.5.17+commit.d19bba13" | sha256sum --check --status - || exit 1) && \
(echo "f851f11fad37496baabaf8d6cb5c057ca0d9754fddb7a351ab580d7fd728cb94 solc-linux-amd64-v0.8.9+commit.e5eed63a" | sha256sum --check --status - || exit 1) && \
(echo "c7effacf28b9d64495f81b75228fbf4266ac0ec87e8f1adc489ddd8a4dd06d89 solc-linux-amd64-v0.8.10+commit.fc410830" | sha256sum --check --status - || exit 1) && \
(echo "556c3ec44faf8ff6b67933fa8a8a403abe82c978d6e581dbfec4bd07360bfbf3 solc-linux-amd64-v0.8.12+commit.f00d7308" | sha256sum --check --status - || exit 1) && \
echo "caching compilers" && \
mkdir -p ~/.cache/hardhat-nodejs/compilers/linux-amd64 && \
cp solc-linux-amd64-v0.5.17+commit.d19bba13 ~/.cache/hardhat-nodejs/compilers/linux-amd64/ && \
cp solc-linux-amd64-v0.8.9+commit.e5eed63a ~/.cache/hardhat-nodejs/compilers/linux-amd64/ && \
cp solc-linux-amd64-v0.8.10+commit.fc410830 ~/.cache/hardhat-nodejs/compilers/linux-amd64/ && \
cp solc-linux-amd64-v0.8.12+commit.f00d7308 ~/.cache/hardhat-nodejs/compilers/linux-amd64/ && \
mkdir -p ~/.svm/0.5.17 && \
cp solc-linux-amd64-v0.5.17+commit.d19bba13 ~/.svm/0.5.17/solc-0.5.17 && \
mkdir -p ~/.svm/0.8.9 && \
cp solc-linux-amd64-v0.8.9+commit.e5eed63a ~/.svm/0.8.9/solc-0.8.9 && \
mkdir -p ~/.svm/0.8.10 && \
cp solc-linux-amd64-v0.8.10+commit.fc410830 ~/.svm/0.8.10/solc-0.8.10 && \
mkdir -p ~/.svm/0.8.12 && \
cp solc-linux-amd64-v0.8.12+commit.f00d7308 ~/.svm/0.8.12/solc-0.8.12 && \
rm solc-linux-amd64-v0.5.17+commit.d19bba13 && \
rm solc-linux-amd64-v0.8.9+commit.e5eed63a && \
rm solc-linux-amd64-v0.8.10+commit.fc410830 && \
rm solc-linux-amd64-v0.8.12+commit.f00d7308
RUN echo "downloading and verifying Codecov uploader" && \
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import && \
curl -Os "https://uploader.codecov.io/latest/linux/codecov" && \
curl -Os "https://uploader.codecov.io/latest/linux/codecov.SHA256SUM" && \
curl -Os "https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig" && \
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM && \
shasum -a 256 -c codecov.SHA256SUM || sha256sum -c codecov.SHA256SUM && \
cp codecov /usr/local/bin/codecov && \
chmod +x /usr/local/bin/codecov && \
rm codecov
RUN echo "downloading mockery tool" && \
mkdir -p mockery-tmp-dir && \
curl -o mockery-tmp-dir/mockery.tar.gz -sL https://github.com/vektra/mockery/releases/download/v2.28.1/mockery_2.28.1_Linux_x86_64.tar.gz && \
tar -xzvf mockery-tmp-dir/mockery.tar.gz -C mockery-tmp-dir && \
cp mockery-tmp-dir/mockery /usr/local/bin/mockery && \
chmod +x /usr/local/bin/mockery && \
rm -rf mockery-tmp-dir
#!/usr/bin/env bash
set -euo pipefail
DOCKER_REPO=$1
GIT_TAG=$2
GIT_SHA=$3
IMAGE_NAME=$(echo "$GIT_TAG" | grep -Eow '^(fault-detector|proxyd|indexer|op-[a-z0-9\-]*)' || true)
if [ -z "$IMAGE_NAME" ]; then
echo "image name could not be parsed from git tag '$GIT_TAG'"
exit 1
fi
IMAGE_TAG=$(echo "$GIT_TAG" | grep -Eow 'v.*' || true)
if [ -z "$IMAGE_TAG" ]; then
echo "image tag could not be parsed from git tag '$GIT_TAG'"
exit 1
fi
SOURCE_IMAGE_TAG="$DOCKER_REPO/$IMAGE_NAME:$GIT_SHA"
TARGET_IMAGE_TAG="$DOCKER_REPO/$IMAGE_NAME:$IMAGE_TAG"
TARGET_IMAGE_TAG_LATEST="$DOCKER_REPO/$IMAGE_NAME:latest"
echo "Checking if docker images exist for '$IMAGE_NAME'"
echo ""
tags=$(gcloud container images list-tags "$DOCKER_REPO/$IMAGE_NAME" --limit 1 --format json)
if [ "$tags" = "[]" ]; then
echo "No existing docker images were found for '$IMAGE_NAME'. The code tagged with '$GIT_TAG' may not have an associated dockerfile or docker build job."
echo "If this service has a dockerfile, add a docker-publish job for it in the circleci config."
echo ""
echo "Exiting"
exit 0
fi
echo "Tagging $SOURCE_IMAGE_TAG with '$IMAGE_TAG'"
gcloud container images add-tag -q "$SOURCE_IMAGE_TAG" "$TARGET_IMAGE_TAG"
# Do not tag with latest if the release is a release candidate.
if [[ "$IMAGE_TAG" == *"rc"* ]]; then
echo "Not tagging with 'latest' because the release is a release candidate."
exit 0
fi
echo "Tagging $SOURCE_IMAGE_TAG with 'latest'"
gcloud container images add-tag -q "$SOURCE_IMAGE_TAG" "$TARGET_IMAGE_TAG_LATEST"
const os = require('os')
// this script unbundles the published packages output
// from changesets action to a key-value pair to be used
// with our publishing CI workflow
data = process.argv[2]
data = JSON.parse(data)
for (const i of data) {
const name = i.name.replace("@eth-optimism/", "")
const version = i.version
process.stdout.write(`::set-output name=${name}::${version}` + os.EOL)
}
#!/usr/bin/env bash
BEDROCK_TAGS_REMOTE="$1"
VERSION="$2"
if [ -z "$VERSION" ]; then
echo "You must specify a version."
exit 0
fi
FIRST_CHAR=$(printf '%s' "$VERSION" | cut -c1)
if [ "$FIRST_CHAR" != "v" ]; then
echo "Tag must start with v."
exit 0
fi
git tag "op-bindings/$VERSION"
git tag "op-service/$VERSION"
git push $BEDROCK_TAGS_REMOTE "op-bindings/$VERSION"
git push $BEDROCK_TAGS_REMOTE "op-service/$VERSION"
cd op-chain-ops
go get github.com/ethereum-optimism/optimism/op-bindings@$VERSION
go get github.com/ethereum-optimism/optimism/op-service@$VERSION
go mod tidy
git add .
git commit -am 'chore: Upgrade op-chain-ops dependencies'
git tag "op-chain-ops/$VERSION"
git push $BEDROCK_TAGS_REMOTE "op-chain-ops/$VERSION"
cd ../op-node
go get github.com/ethereum-optimism/optimism/op-bindings@$VERSION
go get github.com/ethereum-optimism/optimism/op-service@$VERSION
go get github.com/ethereum-optimism/optimism/op-chain-ops@$VERSION
go mod tidy
echo Please update the version to ${VERSION} in op-node/version/version.go
read -p "Press [Enter] key to continue"
git add .
git commit -am 'chore: Upgrade op-node dependencies'
git push $BEDROCK_TAGS_REMOTE
git tag "op-node/$VERSION"
git push $BEDROCK_TAGS_REMOTE "op-node/$VERSION"
cd ../op-proposer
go get github.com/ethereum-optimism/optimism/op-bindings@$VERSION
go get github.com/ethereum-optimism/optimism/op-service@$VERSION
go get github.com/ethereum-optimism/optimism/op-node@$VERSION
go mod tidy
echo Please update the version to ${VERSION} in op-proposer/cmd/main.go
read -p "Press [Enter] key to continue"
git add .
git commit -am 'chore: Upgrade op-proposer dependencies'
git push $BEDROCK_TAGS_REMOTE
git tag "op-proposer/$VERSION"
git push $BEDROCK_TAGS_REMOTE "op-proposer/$VERSION"
cd ../op-batcher
go get github.com/ethereum-optimism/optimism/op-bindings@$VERSION
go get github.com/ethereum-optimism/optimism/op-service@$VERSION
go get github.com/ethereum-optimism/optimism/op-node@$VERSION
go get github.com/ethereum-optimism/optimism/op-proposer@$VERSION
go mod tidy
echo Please update the version to ${VERSION} in op-batcher/cmd/main.go
read -p "Press [Enter] key to continue"
git add .
git commit -am 'chore: Upgrade op-batcher dependencies'
git push $BEDROCK_TAGS_REMOTE
git tag "op-batcher/$VERSION"
git push $BEDROCK_TAGS_REMOTE "op-batcher/$VERSION"
cd ../op-e2e
go get github.com/ethereum-optimism/optimism/op-bindings@$VERSION
go get github.com/ethereum-optimism/optimism/op-service@$VERSION
go get github.com/ethereum-optimism/optimism/op-node@$VERSION
go get github.com/ethereum-optimism/optimism/op-proposer@$VERSION
go get github.com/ethereum-optimism/optimism/op-batcher@$VERSION
go mod tidy
git add .
git commit -am 'chore: Upgrade op-e2e dependencies'
git push $BEDROCK_TAGS_REMOTE
git tag "op-e2e/$VERSION"
git push $BEDROCK_TAGS_REMOTE "op-e2e/$VERSION"
\ No newline at end of file
#!/usr/bin/env python3
import json
import subprocess
import os
GETH_VERSION='v1.11.2'
def main():
for project in ('.', 'indexer'):
print(f'Updating {project}...')
update_mod(project)
def update_mod(project):
print('Replacing...')
subprocess.run([
'go',
'mod',
'edit',
'-replace',
f'github.com/ethereum/go-ethereum@{GETH_VERSION}=github.com/ethereum-optimism/op-geth@optimism'
], cwd=os.path.join(project), check=True)
print('Tidying...')
subprocess.run([
'go',
'mod',
'tidy'
], cwd=os.path.join(project), check=True)
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment