Skip to content

Commit

Permalink
ci: fix api service issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond committed May 15, 2024
1 parent 8835af1 commit 9a5e664
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/software-upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ jobs:

- name: Save up space
run: |
rm -rf /tmp/genesis.json
rm -rf ~/.elys/config/genesis.json
- name: Prepare second validator data
Expand Down
21 changes: 21 additions & 0 deletions cmd/upgrade-assure/backup-genesis-init-file.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"log"
"os/exec"
)

func backupGenesisInitFile(homePath string) {
// Copy genesis.json to genesis_init.json
args := []string{
homePath + "/config/genesis.json",
homePath + "/config/genesis_init.json",
}

if err := exec.Command("cp", args...).Run(); err != nil {
log.Fatalf(ColorRed+"Failed to copy genesis.json to genesis_init.json: %v", err)
}

// If execution reaches here, the command was successful
log.Printf(ColorYellow + "Genesis file copied to genesis_init.json")
}
21 changes: 21 additions & 0 deletions cmd/upgrade-assure/restore-genesis-init-file.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"log"
"os/exec"
)

func restoreGenesisInitFile(homePath string) {
// Copy genesis_init.json to genesis.json
args := []string{
homePath + "/config/genesis_init.json",
homePath + "/config/genesis.json",
}

if err := exec.Command("cp", args...).Run(); err != nil {
log.Fatalf(ColorRed+"Failed to copy genesis_init.json to genesis.json: %v", err)
}

// If execution reaches here, the command was successful
log.Printf(ColorYellow + "Genesis file copied to genesis.json")
}
6 changes: 6 additions & 0 deletions cmd/upgrade-assure/upgrade-assure.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ func main() {
// validate genesis
validateGenesis(oldBinaryPath, homePath)

// backup genesis init file
backupGenesisInitFile(homePath)

// update genesis
updateGenesis(validatorBalance, homePath, genesisFilePath)
}
Expand Down Expand Up @@ -153,6 +156,9 @@ func main() {
}

if !skipPrepareValidatorData {
// restore genesis init file
restoreGenesisInitFile(homePath)

// copy data from node 1 to node 2
copyDataFromNodeToNode(homePath, homePath2)

Expand Down

0 comments on commit 9a5e664

Please sign in to comment.