-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
195 additions
and
4 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,26 @@ | ||
# Operator UI | ||
|
||
NOTE: If you're looking for the source of operator UI, it has now been moved to https://github.com/smartcontractkit/operator-ui | ||
|
||
This directory instead now as a collection of scripts for maintaining the version of operator UI to pull in when developing and building the chainlink node. | ||
|
||
## About | ||
|
||
This package is responsible for rendering the UI of the chainlink node, which allows interactions with node jobs, jobs runs, configuration and any other related tasks. | ||
|
||
## Installation | ||
|
||
### Requirements | ||
|
||
The `install.sh` script handles installing the specified tag of operator UI within the [tag file](./TAG). When executed, it downloads then moves the static assets of operator UI into the `core/web/assets` path. Then, when the chainlink binary is built, these assets are included into the build that gets served. | ||
|
||
## Updates | ||
|
||
### Requirements | ||
|
||
- gh cli ^2.15.0 https://github.com/cli/cli/releases/tag/v2.15.0 | ||
- jq ^1.6 https://stedolan.github.io/jq/ | ||
|
||
The `update.sh` script will check for the latest release from the `smartcontractkit/operator-ui` repository, if the latest release is newer than the current tag, it'll update the [tag file](./TAG) with the corresponding latest tag. Checking for updates is automatically [handled by CI](../.github/workflows/operator-ui.yml), where any new detected updates will be pushed to a branch and have a PR opened against `develop`. | ||
|
||
See https://docs.github.com/en/rest/releases/releases#get-the-latest-release for how a latest release is determined. |
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 @@ | ||
v0.8.0-91e5ba4 |
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,37 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Dependencies: | ||
# gh cli ^2.15.0 https://github.com/cli/cli/releases/tag/v2.15.0 | ||
# jq ^1.6 https://stedolan.github.io/jq/ | ||
|
||
repo=smartcontractkit/operator-ui | ||
gitRoot=$(git rev-parse --show-toplevel) | ||
cd "$gitRoot/operator_ui" | ||
|
||
tag_file=TAG | ||
current_tag=$(cat $tag_file) | ||
echo "Currently pinned tag for $repo is $current_tag" | ||
|
||
echo "Getting latest release for tag for $repo" | ||
release=$(gh release view -R $repo --json 'tagName,body') | ||
latest_tag=$(echo "$release" | jq -r '.tagName') | ||
body=$(echo "$release" | jq -r '.body') | ||
|
||
if [ "$current_tag" = "$latest_tag" ]; then | ||
echo "Tag $current_tag is up to date." | ||
exit 0 | ||
else | ||
echo "Tag $current_tag is out of date, updating $tag_file file to latest version..." | ||
echo "$latest_tag" >"$tag_file" | ||
echo "Tag updated $current_tag -> $latest_tag" | ||
if [ "$CI" ]; then | ||
echo "current_tag=$current_tag" >> $GITHUB_OUTPUT | ||
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT | ||
# See https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#setting-the-pull-request-body-from-a-file | ||
body="${body//'%'/'%25'}" | ||
body="${body//$'\n'/'%0A'}" | ||
body="${body//$'\r'/'%0D'}" | ||
echo "body=$body" >> $GITHUB_OUTPUT | ||
fi | ||
fi |
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,67 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
owner=smartcontractkit | ||
repo=operator-ui | ||
fullRepo=${owner}/${repo} | ||
|
||
ccipPath=$GOPATH/pkg/mod/github.com/smartcontractkit/ccip | ||
ccipV2=$(ls -1 $ccipPath | grep v2 | tail -n 1) | ||
|
||
gitRoot=$(git rev-parse --show-toplevel || pwd) | ||
cd "$gitRoot/operator_ui" | ||
unpack_dir="$ccipPath/$ccipV2/core/web/assets" | ||
tag=$(cat TAG) | ||
# Remove the version prefix "v" | ||
strippedTag="${tag:1}" | ||
# Taken from https://github.com/kennyp/asdf-golang/blob/master/lib/helpers.sh | ||
msg() { | ||
echo -e "\033[32m$1\033[39m" >&2 | ||
} | ||
|
||
err() { | ||
echo -e "\033[31m$1\033[39m" >&2 | ||
} | ||
|
||
fail() { | ||
err "$1" | ||
exit 1 | ||
} | ||
|
||
msg "Getting release $tag for $fullRepo" | ||
# https://docs.github.com/en/rest/releases/releases#get-a-release-by-tag-name | ||
asset_name=${owner}-${repo}-${strippedTag}.tgz | ||
download_url=https://github.com/${fullRepo}/releases/download/${tag}/${asset_name} | ||
|
||
# Inspired from https://github.com/kennyp/asdf-golang/blob/master/bin/download#L29 | ||
msg "Download URL: ${download_url}" | ||
# Check if we're able to download first | ||
http_code=$(curl -LIs -w '%{http_code}' -o /dev/null "$download_url") | ||
if [ "$http_code" -eq 404 ] || [ "$http_code" -eq 403 ]; then | ||
fail "URL: ${download_url} returned status ${http_code}" | ||
fi | ||
# Then go ahead if we get a success code | ||
msg "Downloading ${fullRepo}:${tag} asset: $asset_name..." | ||
msg "" | ||
curl -L -o "$asset_name" "$download_url" | ||
|
||
msg "Unpacking asset $asset_name" | ||
tar -xvzf "$asset_name" | ||
|
||
msg "" | ||
msg "Removing old contents of $unpack_dir" | ||
rm -rf "$unpack_dir" | ||
|
||
if [ ! -d "$unpack_dir" ] | ||
then | ||
echo "$unpack_dir folder path not present, creating $ccipPath/$ccipV2/core/web" | ||
chmod u+rwx $ccipPath/$ccipV2/core/web | ||
mkdir -p $unpack_dir | ||
fi | ||
|
||
msg "Copying contents of package/artifacts to $unpack_dir" | ||
cp -rf package/artifacts/. "$unpack_dir" || true | ||
|
||
msg "Cleaning up" | ||
rm -r package | ||
rm "$asset_name" |
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
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,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Checks that the correct abigen is installed in this directory, and installs it | ||
# if not. | ||
|
||
set -e | ||
|
||
# Version of abigen to install. Must be run within chainlink project | ||
GETH_VERSION=$(go list -json -m github.com/ethereum/go-ethereum | jq -r .Version) | ||
GETH_REPO_URL="https://github.com/ethereum/go-ethereum" | ||
|
||
function realpath { echo $(cd $(dirname $1); pwd)/$(basename $1); } | ||
THIS_DIR="$(realpath "$(dirname $0)")" | ||
|
||
NATIVE_ABIGEN_VERSION=v"$( | ||
"$THIS_DIR/abigen" --version 2> /dev/null | \ | ||
grep -E -o '([0-9]+\.[0-9]+\.[0-9]+)' | ||
)" || true | ||
|
||
if [ "$NATIVE_ABIGEN_VERSION" == "$GETH_VERSION" ]; then | ||
echo "Correct abigen version already installed." | ||
exit 0 | ||
fi | ||
|
||
function cleanup() { | ||
rm -rf "$TMPDIR" | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
TMPDIR="$(mktemp -d)" | ||
|
||
pushd "$TMPDIR" | ||
|
||
git clone --depth=1 --single-branch --branch "$GETH_VERSION" "$GETH_REPO_URL" | ||
cd go-ethereum/cmd/abigen | ||
go build | ||
rm -f "$THIS_DIR/abigen" # necessary on MacOS for code signing | ||
cp ./abigen "$THIS_DIR" | ||
|
||
popd | ||
|
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,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$0")" | ||
|
||
COMMIT_SHA=${COMMIT_SHA:-$(git rev-parse HEAD)} | ||
VERSION=${VERSION:-$(cat "../../VERSION")} | ||
|
||
echo "-X github.com/smartcontractkit/chainlink/v2/core/static.Version=$VERSION -X github.com/smartcontractkit/chainlink/v2/core/static.Sha=$COMMIT_SHA" |