-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ci tool support to operator, fix some errors (#76)
* add a docker for operator tool * more docker files to ops and fix docker compose failed by allow list * not must need config * use bullseye add ca-certificates * fix RegisterOperatorWithAvs failed by not use env config * add socket, support deregister to avs * add salt
- Loading branch information
Showing
20 changed files
with
308 additions
and
55 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,108 @@ | ||
name: Release Operator Tool | ||
on: | ||
push: | ||
tags: ["*"] | ||
workflow_dispatch: | ||
# pull_request: # for testing only | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
CARGO_TERM_COLOR: always | ||
# https://github.com/mozilla/sccache/releases | ||
SCCACHE_TAR_URL: https://github.com/mozilla/sccache/releases/download/v0.7.4/sccache-v0.7.4-x86_64-unknown-linux-musl.tar.gz | ||
SCCACHE_CACHE_SIZE: "3G" | ||
RUSTC_WRAPPER: sccache | ||
SUBWASM_VERSION: v0.20.0 | ||
CARGO_INCREMENTAL: "0" | ||
CARGO_NET_GIT_FETCH_WITH_CLI: true | ||
ECR_REPO: 305587085711.dkr.ecr.us-west-2.amazonaws.com/mach-operator-tool | ||
PUB_REPO: public.ecr.aws | ||
|
||
jobs: | ||
build-docker-image: | ||
name: Build Docker Image and extract files | ||
runs-on: ["self-hosted", "linux", "x64", "ubuntu-latest"] | ||
steps: | ||
- name: Login to ECR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.ECR_REPO }} | ||
username: ${{ secrets.ECR_ACCESS_KEY_ID }} | ||
password: ${{ secrets.ECR_ACCESS_KEY }} | ||
|
||
- name: Login to public ECR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.PUB_REPO }} | ||
username: ${{ secrets.ECR_ACCESS_KEY_ID }} | ||
password: ${{ secrets.ECR_ACCESS_KEY }} | ||
|
||
- name: Checkout Sources | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: "true" | ||
token: ${{ secrets.GIT_CREDENTIALS }} | ||
|
||
- uses: de-vri-es/setup-git-credentials@v2 | ||
with: | ||
credentials: https://${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_CREDENTIALS }}@github.com | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
id: docker-builder | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Prepare Environment Variables | ||
run: | | ||
echo "HOME=$HOME" | tee -a $GITHUB_ENV | ||
echo "XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}" | tee -a $GITHUB_ENV | ||
echo "SHORT_SHA=${GITHUB_SHA::7}" | tee -a $GITHUB_ENV | ||
GIT_TAG=$(git tag --points-at HEAD) | ||
echo "GIT_TAG=$GIT_TAG" | tee -a $GITHUB_ENV | ||
GIT_BRANCH=$(git branch --show-current) | ||
echo "GIT_BRANCH=$GIT_BRANCH" | tee -a $GITHUB_ENV | ||
echo "REF_NAME=$(echo ${GIT_TAG:-$GITHUB_REF_NAME} | sed 's/[^a-zA-Z0-9._]/-/g')" | tee -a $GITHUB_ENV | ||
- run: cat $HOME/.gitconfig && cat $XDG_CONFIG_HOME/git/credentials | ||
|
||
- name: Extract operator metadata (tags, labels) for Docker | ||
id: operator-meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.ECR_REPO }} | ||
${{ env.PUB_REPO }}/altlayer/mach-operator-tool | ||
flavor: | | ||
prefix= | ||
suffix= | ||
tags: | | ||
type=sha,format=short,prefix= | ||
type=ref,event=branch | ||
type=ref,event=branch,suffix=-${{ github.run_number }} | ||
type=ref,event=tag | ||
type=raw,value=${{ env.REF_NAME }},enable=${{ github.event_name == 'pull_request' }} | ||
type=raw,value=${{ env.GIT_BRANCH }},enable=${{ env.GIT_BRANCH != '' }} | ||
type=raw,value=latest,enable=${{ env.GIT_BRANCH == 'master' }} | ||
- name: Build operator docker with cache and push images | ||
uses: docker/build-push-action@v5 | ||
id: docker_operator_tool_build | ||
with: | ||
context: . | ||
builder: ${{ steps.docker-builder.outputs.name }} | ||
target: app | ||
push: ${{ github.event_name != 'pull_request' }} | ||
provenance: false | ||
cache-from: | | ||
type=registry,ref=${{ env.ECR_REPO }}:latest | ||
type=registry,ref=${{ env.ECR_REPO }}:${{ env.REF_NAME }} | ||
secret-files: | | ||
git_config=${{ env.HOME }}/.gitconfig | ||
git_credentials=${{ env.XDG_CONFIG_HOME }}/git/credentials | ||
file: ops/operator-tool.Dockerfile | ||
labels: ${{ steps.operator-meta.outputs.labels }} | ||
tags: ${{ steps.operator-meta.outputs.tags }} | ||
|
||
|
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,40 @@ | ||
package actions | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
sdkutils "github.com/Layr-Labs/eigensdk-go/utils" | ||
"github.com/alt-research/avs/core/config" | ||
"github.com/alt-research/avs/operator" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
func DeregisterOperatorWithAvs(ctx *cli.Context) error { | ||
configPath := ctx.GlobalString(config.ConfigFileFlag.Name) | ||
nodeConfig := config.NodeConfig{} | ||
|
||
if configPath != "" { | ||
err := sdkutils.ReadYamlConfig(configPath, &nodeConfig) | ||
if err != nil { | ||
return err | ||
} | ||
configJson, err := json.MarshalIndent(nodeConfig, "", " ") | ||
if err != nil { | ||
log.Fatalf(err.Error()) | ||
} | ||
log.Println("Config:", string(configJson)) | ||
} | ||
|
||
operator, err := operator.NewOperatorFromConfig(nodeConfig) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = operator.DeregisterOperatorWithAvs() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
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
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
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
Oops, something went wrong.