Skip to content

Commit

Permalink
Updated workflow to achieve multi-arch build on an automated way.
Browse files Browse the repository at this point in the history
Updated entrypoint.sh with a more complete one.
Updated go.mod/sum with geo-mesh needs.
  • Loading branch information
jorgecuesta committed Jan 30, 2024
1 parent 5af9273 commit de4a5cb
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 127 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ name: Build and push images
on:
workflow_dispatch:
push:
branches: [staging]
branches: [geo-mesh]
tags: ['*']
pull_request:
branches: [staging]
branches: [geo-mesh]

jobs:
build-images:
Expand All @@ -27,20 +27,19 @@ jobs:
DOCKER_METADATA_PR_HEAD_SHA: "true"
with:
images: |
ghcr.io/pokt-network/pocket-v0
poktscan/pocket-core
tags: |
type=schedule
type=ref,event=tag
type=ref,event=branch
type=ref,event=pr
type=sha
type=sha,format=long
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
Expand Down
46 changes: 31 additions & 15 deletions .github/workflows/entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/expect

# Command to run
set command $argv
set timeout -1

# Send `pocket stop` when interrupted to prevent corruption
proc graceful_exit {} {
send_user "Gracefully exiting Pocket...\n"
spawn sh -c "pocket stop"
}

trap graceful_exit {SIGINT SIGTERM}

# Command to run
set command $argv
set timeout -1
proc graceful_mesh_exit {pid} {
send_user "Gracefully exiting Pocket...\n"
exec kill -SIGTERM $pid
}

# Create work dir
spawn sh -c "mkdir -p /home/app/.pocket/config"
expect eof

# Pull variables from env if set
set genesis ""
Expand All @@ -26,6 +26,12 @@ catch {set chains $env(POCKET_CORE_CHAINS)}
set config ""
catch {set config $env(POCKET_CORE_CONFIG)}

set core_key ""
catch {set core_key $env(POCKET_CORE_KEY)}

set core_passphrase ""
catch {set core_passphrase $env(POCKET_CORE_PASSPHRASE)}

# Create dynamic config files
if {$genesis != ""} {
set genesis_file [open /home/app/.pocket/config/genesis.json w]
Expand All @@ -46,26 +52,36 @@ if {$config != ""} {
send_user "CONFIG loaded from env\n"
}

# If key isn't passed in, start the node
if { $env(POCKET_CORE_KEY) eq "" } {
# if not --keybase=false
# e.g. "pocket start --keybase=false --mainnet --datadir=/home/app/.pocket/"
if {[regexp -nocase "keybase=false" $command]} {
spawn sh -c "$command"
} elseif { $core_key eq "" } {
# If key isn't passed in, start the node
log_user 0
spawn sh -c "$command"
send -- "$env(POCKET_CORE_PASSPHRASE)\n"
send -- "$core_passphrase\n"
log_user 1
} else {
# If key is passed in, load it into the local accounts
# If key is passed in, load it into the local accounts
log_user 0
spawn pocket accounts import-raw $env(POCKET_CORE_KEY)
spawn pocket accounts import-raw $core_key
sleep 1
send -- "$env(POCKET_CORE_PASSPHRASE)\n"
send -- "$core_passphrase\n"
expect eof
spawn sh -c "pocket accounts set-validator `pocket accounts list | cut -d' ' -f2- `"
sleep 1
send -- "$env(POCKET_CORE_PASSPHRASE)\n"
send -- "$core_passphrase\n"
expect eof
log_user 1
spawn sh -c "$command"
}

set pid [exp_pid]
if {![regexp -nocase "start-mesh" $command]} {
trap graceful_exit {SIGINT SIGTERM}
} else {
trap "graceful_mesh_exit $pid" {SIGINT SIGTERM}
}
expect eof
exit
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ replace github.com/tendermint/tendermint => github.com/pokt-network/tendermint v
replace github.com/tendermint/tm-db => github.com/pokt-network/tm-db v0.5.2-0.20220118210553-9b2300f289ba

require (
github.com/cosmos/gogoproto v1.4.10
github.com/cucumber/godog v0.12.5
github.com/akrylysov/pogreb v0.10.1
github.com/alitto/pond v1.8.3
github.com/cosmos/gogoproto v1.4.10
github.com/cucumber/godog v0.12.6
github.com/deckarep/golang-set/v2 v2.3.0
github.com/go-kit/kit v0.12.0
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.3
github.com/golang/protobuf v1.5.2
github.com/hashicorp/go-retryablehttp v0.7.1
github.com/hashicorp/golang-lru v0.5.4
github.com/jordanorelli/lexnum v0.0.0-20141216151731-460eeb125754
Expand Down
Loading

0 comments on commit de4a5cb

Please sign in to comment.