Skip to content

Commit

Permalink
Merge pull request #761 from XinFinOrg/dev-upgrade
Browse files Browse the repository at this point in the history
Monthly Merge from dev upgrade branch to master
  • Loading branch information
benjamin202410 authored Jan 13, 2025
2 parents 09efd37 + 2a26a57 commit 3a7b90d
Show file tree
Hide file tree
Showing 712 changed files with 32,215 additions and 36,299 deletions.
2 changes: 0 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ core/ @karalabe @holiman
eth/ @karalabe
les/ @zsfelfoldi
light/ @zsfelfoldi
mobile/ @karalabe
p2p/ @fjl @zsfelfoldi
whisper/ @gballet @gluk256
114 changes: 43 additions & 71 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: actions/setup-go@v5
with:
cache: false
go-version: '1.21.x'
go-version: '1.22.x'
- name: Run tests
run: ${{ matrix.script }}
env:
Expand Down Expand Up @@ -100,94 +100,66 @@ jobs:
echo "image_name=$image_name"
echo "image_name=$image_name" >> "$GITHUB_OUTPUT"
devnet_terraform_apply:
devnet_k8_apply:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev-upgrade' && !startsWith(github.ref, 'refs/tags/')
needs: devnet_build_push
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: Terraform Apply
- name: Set up kubectl
uses: azure/setup-kubectl@v4
with:
version: 'v1.19.11'
- name: Decode and configure kubeconfig
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBE_CONFIG }}" | base64 --decode > $HOME/.kube/config
chmod 600 $HOME/.kube/config
git_hash=$(git rev-parse --short "$GITHUB_SHA")
cd cicd/devnet/terraform
terraform init ${{ env.tf_init_cli_options }}
terraform apply -var "docker_tag=dev-upgrade-${git_hash}" ${{ env.tf_apply_cli_options }}
kubectl set image deployment/devnet1 devnet1=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet2 devnet2=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet3 devnet3=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet4 devnet4=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet5 devnet5=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet6 devnet6=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet7 devnet7=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet8 devnet8=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet9 devnet9=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet10 devnet10=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet11 devnet11=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet12 devnet12=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet13 devnet13=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet14 devnet14=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet15 devnet15=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet16 devnet16=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet17 devnet17=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/devnet18 devnet18=xinfinorg/devnet:dev-upgrade-${git_hash} ||
echo done
rpcnode_terraform_apply:
rpc_k8_apply:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev-upgrade' && !startsWith(github.ref, 'refs/tags/')
needs: devnet_build_push
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: Terraform Apply
run: |
cd cicd/terraform
terraform init ${{ env.tf_init_cli_options }}
terraform apply ${{ env.tf_apply_cli_options }}
- name: Update RPC nodes image
uses: dawidd6/action-ansible-playbook@v2
- name: Set up kubectl
uses: azure/setup-kubectl@v4
with:
playbook: playbooks/update-image.yaml
directory: ./cicd/ansible
key: ${{secrets.SSH_PRIVATE_KEY_DEVNET}}
options: |
--inventory inventory.yaml
--extra-vars network=ec2_rpcs
--extra-vars rpc_image=${{ needs.devnet_build_push.outputs.output1 }}
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/')
needs: rpcnode_terraform_apply
environment: testnet
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
version: 'v1.19.11'
- name: Decode and configure kubeconfig
run: |
aws ecs update-service --region ap-southeast-1 --cluster testnet-xdcnode-cluster --service ecs-service-testnet-rpc1 --force-new-deployment --no-cli-pager | head -n 10;
mainnet_dev-upgrade_node:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev-upgrade' && !startsWith(github.ref, 'refs/tags/')
needs: rpcnode_terraform_apply
environment: mainnet
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 mainnet-xdcnode-cluster --service ecs-service-mainnet-rpc1 --force-new-deployment --no-cli-pager | head -n 10;
mkdir -p $HOME/.kube
echo "${{ secrets.KUBE_CONFIG }}" | base64 --decode > $HOME/.kube/config
chmod 600 $HOME/.kube/config
git_hash=$(git rev-parse --short "$GITHUB_SHA")
kubectl set image deployment/devnetrpc devnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/testnetrpc testnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} ||
kubectl set image deployment/mainnetrpc mainnetrpc=xinfinorg/devnet:dev-upgrade-${git_hash} ||
echo done
devnet_send_notification:
runs-on: ubuntu-latest
needs: devnet_terraform_apply
needs: devnet_k8_apply
if: github.ref == 'refs/heads/dev-upgrade' && !startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/deploy_rpc_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:
network:
type: choice
description: 'devnet, testnet, or mainnet'
options:
options:
- devnet
- testnet
- mainnet
rpc_image:
description: 'full image name'

jobs:
ansible:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Update RPC nodes image
uses: dawidd6/action-ansible-playbook@v2
with:
Expand All @@ -38,4 +38,3 @@ jobs:
- name: Send deployment notification
run: |
curl --location --request POST "66.94.98.186:8080/deploy?environment=${{inputs.network}}&service=xdc_rpc&version=${{inputs.rpc_image}}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ build/_vendor/pkg

# used by the Makefile
/build/_workspace/
/build/cache/
/build/bin/
/XDC*.zip

Expand Down
79 changes: 79 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# This file configures github.com/golangci/golangci-lint.

run:
timeout: 20m
tests: true

linters:
disable-all: true
enable:
- goimports
- gosimple
- govet
- ineffassign
- misspell
- unconvert
- typecheck
- unused
- staticcheck
- bidichk
- durationcheck
- copyloopvar
- whitespace
- revive # only certain checks enabled
- durationcheck
- gocheckcompilerdirectives
- reassign
- mirror
- tenv
### linters we tried and will not be using:
###
# - structcheck # lots of false positives
# - errcheck #lot of false positives
# - contextcheck
# - errchkjson # lots of false positives
# - errorlint # this check crashes
# - exhaustive # silly check
# - makezero # false positives
# - nilerr # several intentional

linters-settings:
gofmt:
simplify: true
revive:
enable-all-rules: false
# here we enable specific useful rules
# see https://golangci-lint.run/usage/linters/#revive for supported rules
rules:
- name: receiver-naming
severity: warning
disabled: false
exclude: [""]

issues:
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
exclude-dirs-use-default: true
exclude-files:
- core/genesis_alloc.go
exclude-rules:
- path: crypto/bn256/cloudflare/optate.go
linters:
- deadcode
- staticcheck
- path: crypto/bn256/
linters:
- revive
- path: cmd/utils/flags.go
text: "SA1019: cfg.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
- path: cmd/utils/flags.go
text: "SA1019: ethconfig.Defaults.TxLookupLimit is deprecated: use 'TransactionHistory' instead."
- path: internal/build/pgp.go
text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.'
- path: core/vm/contracts.go
text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.'
exclude:
- 'SA1019: event.TypeMux is deprecated: use Feed'
- 'SA1019: strings.Title is deprecated'
- 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.'
- 'SA1029: should not use built-in type string as key for value'
Loading

0 comments on commit 3a7b90d

Please sign in to comment.