mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Ci improvement (#496)
* move devnet rpc node to rpc terraform and start to tag by sha
This commit is contained in:
parent
4d8effebe5
commit
42c57c6570
10 changed files with 61 additions and 33 deletions
21
.github/workflows/ci.yml
vendored
21
.github/workflows/ci.yml
vendored
|
|
@ -86,10 +86,13 @@ jobs:
|
|||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
- name: Build and Push Docker images
|
||||
run: |
|
||||
git_hash=$(git rev-parse --short "$GITHUB_SHA")
|
||||
docker pull xinfinorg/devnet:latest
|
||||
docker tag xinfinorg/devnet:latest xinfinorg/devnet:previous
|
||||
docker rmi xinfinorg/devnet:latest
|
||||
docker build -t xinfinorg/devnet:latest -f cicd/Dockerfile .
|
||||
docker tag xinfinorg/devnet:latest xinfinorg/devnet:dev-upgrade-${git_hash}
|
||||
docker push xinfinorg/devnet:dev-upgrade-${git_hash}
|
||||
docker push xinfinorg/devnet:latest
|
||||
docker push xinfinorg/devnet:previous
|
||||
|
||||
|
|
@ -105,9 +108,10 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Terraform Apply
|
||||
run: |
|
||||
git_hash=$(git rev-parse --short "$GITHUB_SHA")
|
||||
cd cicd/devnet/terraform
|
||||
terraform init ${{ env.tf_init_cli_options }}
|
||||
terraform apply ${{ env.tf_apply_cli_options }}
|
||||
terraform apply -var "docker_tag=dev-upgrade-${git_hash}" ${{ env.tf_apply_cli_options }}
|
||||
sleep 5
|
||||
source .env
|
||||
for ((i=$us_east_2_start;i<$us_east_2_end;i++)); do
|
||||
|
|
@ -122,7 +126,6 @@ jobs:
|
|||
echo "Force deploy xdc-$i"
|
||||
aws ecs update-service --region ap-southeast-2 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment --no-cli-pager | head -n 10;
|
||||
done
|
||||
aws ecs update-service --region ap-southeast-1 --cluster devnet-xdcnode-cluster --service ecs-service-rpc1 --force-new-deployment --no-cli-pager | head -n 10;
|
||||
|
||||
rpcnode_terraform_apply:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -139,6 +142,20 @@ jobs:
|
|||
terraform init ${{ env.tf_init_cli_options }}
|
||||
terraform apply ${{ env.tf_apply_cli_options }}
|
||||
|
||||
devnet_dev-upgrade_node:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/dev-upgrade' && !startsWith(github.ref, 'refs/tags/')
|
||||
needs: rpcnode_terraform_apply
|
||||
environment: devnet
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: ECS Update
|
||||
run: |
|
||||
aws ecs update-service --region ap-southeast-1 --cluster devnet-xdcnode-cluster --service ecs-service-rpc1 --force-new-deployment --no-cli-pager | head -n 10;
|
||||
|
||||
testnet_dev-upgrade_node:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/dev-upgrade' && !startsWith(github.ref, 'refs/tags/')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
log_level=3
|
||||
log_level=2
|
||||
|
||||
# Ohio
|
||||
us_east_2_start=0
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ module "us-east-2" {
|
|||
devnetNodeKeys = local.devnetNodeKeys["us-east-2"]
|
||||
logLevel = local.logLevel
|
||||
devnet_xdc_ecs_tasks_execution_role_arn = aws_iam_role.devnet_xdc_ecs_tasks_execution_role.arn
|
||||
docker_tag = var.docker_tag
|
||||
providers = {
|
||||
aws = aws.us-east-2
|
||||
}
|
||||
|
|
@ -39,6 +40,7 @@ module "eu-west-1" {
|
|||
devnetNodeKeys = local.devnetNodeKeys["eu-west-1"]
|
||||
logLevel = local.logLevel
|
||||
devnet_xdc_ecs_tasks_execution_role_arn = aws_iam_role.devnet_xdc_ecs_tasks_execution_role.arn
|
||||
docker_tag = var.docker_tag
|
||||
providers = {
|
||||
aws = aws.eu-west-1
|
||||
}
|
||||
|
|
@ -55,27 +57,8 @@ module "ap-southeast-2" {
|
|||
devnetNodeKeys = local.devnetNodeKeys["ap-southeast-2"]
|
||||
logLevel = local.logLevel
|
||||
devnet_xdc_ecs_tasks_execution_role_arn = aws_iam_role.devnet_xdc_ecs_tasks_execution_role.arn
|
||||
docker_tag = var.docker_tag
|
||||
providers = {
|
||||
aws = aws.ap-southeast-2
|
||||
}
|
||||
}
|
||||
|
||||
# WARNING: APSE-1 will only be used to host rpc node
|
||||
# Workaround to avoid conflicts with existing ecs cluster in existing regions
|
||||
provider "aws" {
|
||||
alias = "ap-southeast-1"
|
||||
region = "ap-southeast-1"
|
||||
}
|
||||
|
||||
module "ap-southeast-1-rpc" {
|
||||
source = "./module/region"
|
||||
region = "ap-southeast-1"
|
||||
devnetNodeKeys = local.rpcNodeKeys
|
||||
enableFixedIp = true
|
||||
logLevel = local.logLevel
|
||||
devnet_xdc_ecs_tasks_execution_role_arn = aws_iam_role.devnet_xdc_ecs_tasks_execution_role.arn
|
||||
|
||||
providers = {
|
||||
aws = aws.ap-southeast-1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ data template_file devnet_container_definition {
|
|||
|
||||
vars = {
|
||||
image_environment = "${lookup(each.value, "imageEnvironment", "devnet")}"
|
||||
image_tag = "${lookup(each.value, "imageTag", "latest")}"
|
||||
image_tag = "${lookup(each.value, "imageTag", var.docker_tag)}"
|
||||
node_name = "${each.key}"
|
||||
private_key = "${each.value.pk}"
|
||||
cloudwatch_group = "tf-${each.key}"
|
||||
|
|
|
|||
|
|
@ -22,4 +22,10 @@ variable "enableFixedIp" {
|
|||
description = "a flag to indicate whether fixed ip should be associated to the nodes. This is used for RPC node"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
}
|
||||
|
||||
variable docker_tag {
|
||||
type = string
|
||||
default = "latest"
|
||||
description = "description"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
# Bucket need to be created first. If first time run terraform init, need to comment out the below section
|
||||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "tf-devnet-bucket" // This name need to be updated to be the same as local.s3BucketName. We can't use variable here.
|
||||
key = "tf/terraform_new.tfstate"
|
||||
bucket = "tf-xinfin-bucket" // This name need to be updated to be the same as local.s3BucketName. We can't use variable here.
|
||||
key = "tf/terraform_devnet.tfstate"
|
||||
region = "us-east-1"
|
||||
encrypt = true
|
||||
}
|
||||
}
|
||||
|
||||
data "aws_s3_object" "devnet_xdc_node_config" {
|
||||
bucket = local.s3BucketName
|
||||
bucket = "tf-xinfin-bucket"
|
||||
key = "node-config.json"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
variable docker_tag {
|
||||
type = string
|
||||
default = "latest"
|
||||
description = "description"
|
||||
}
|
||||
|
||||
locals {
|
||||
/**
|
||||
Load the nodes data from s3
|
||||
|
|
@ -39,8 +45,4 @@ locals {
|
|||
for r in local.regions :
|
||||
r.name => { for i in local.keyNames[r.name]: i => local.predefinedNodesConfig[i] }
|
||||
}
|
||||
|
||||
rpcNodeKeys = { "rpc1": local.predefinedNodesConfig["rpc1"]} // we hardcode the rpc to a single node for now
|
||||
|
||||
s3BucketName = "tf-devnet-bucket"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,25 @@ provider "aws" {
|
|||
region = "ap-southeast-1"
|
||||
}
|
||||
|
||||
module "devnet-rpc" {
|
||||
source = "./module/region"
|
||||
region = "ap-southeast-1"
|
||||
nodeKeys = local.rpcDevnetNodeKeys
|
||||
enableFixedIp = true
|
||||
logLevel = local.logLevel
|
||||
xdc_ecs_tasks_execution_role_arn = aws_iam_role.xdc_ecs_tasks_execution_role.arn
|
||||
|
||||
cpu = 1024
|
||||
memory = 4096
|
||||
|
||||
network = "devnet"
|
||||
vpc_cidr = "10.0.0.0/16"
|
||||
subnet_cidr = "10.0.0.0/20"
|
||||
providers = {
|
||||
aws = aws.ap-southeast-1
|
||||
}
|
||||
}
|
||||
|
||||
module "testnet-rpc" {
|
||||
source = "./module/region"
|
||||
region = "ap-southeast-1"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "tf-xinfin-bucket"
|
||||
key = "tf/terraform.tfstate"
|
||||
key = "tf/terraform_rpc.tfstate"
|
||||
region = "us-east-1"
|
||||
encrypt = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ locals {
|
|||
# r.name => { for i in local.keyNames[r.name]: i => local.predefinedNodesConfig[i] }
|
||||
# }
|
||||
|
||||
rpcDevnetNodeKeys = { "devnet-rpc1": local.predefinedNodesConfig["devnet-rpc1"]} // we hardcode the rpc to a single node for now
|
||||
rpcTestnetNodeKeys = { "testnet-rpc1": local.predefinedNodesConfig["testnet-rpc1"]} // we hardcode the rpc to a single node for now
|
||||
rpcMainnetNodeKeys = { "mainnet-rpc1": local.predefinedNodesConfig["mainnet-rpc1"]} // we hardcode the rpc to a single node for now
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue