Skip to content

Commit

Permalink
CI pipeline to run deploy on localhost
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Chua<[email protected]>
  • Loading branch information
jchua99 committed Nov 24, 2023
1 parent cd3e1bf commit 0b3bbdc
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
71 changes: 71 additions & 0 deletions .github/workflows/build_openyurt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build and Test OpenYurt Deployer

on:
push:
branches: [ openyurt, openyurt-deploy, openyurt-deploy-ci ]
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
branches: [ main, legacy-firecracker-v0.24.0-with-upf-support, openyurt ]
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:

env:
GOOS: linux
GO111MODULE: on

jobs:
build_openyurt:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: Check out the code
uses: actions/checkout@v4

- name: Build scripts
run:
pushd scripts/openyurt-deployer && go build -o oy_deploy && popd

- name: Show scripts help info
run:
./scripts/openyurt-deployer/oy_deploy help

- name: Allow root login
run: |
echo "PermitRootLogin=yes" | sudo tee -a /etc/ssh/sshd_config
- name: Set up SSH and run deploy
run: |
apt-get update
apt-get install -y openssh-server
service ssh start
eval "$(ssh-agent -s)"
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
cat > ~/.ssh/config <<EOF
Host host.example
User $USER
HostName 127.0.0.1
IdentityFile ~/.ssh/id_rsa
EOF
echo -n '' | cat - ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
service ssh restart
service ssh status
ssh-add ~/.ssh/id_rsa

cat ~/.ssh/authorized_keys
chmod og-rw ~/.ssh

cd scripts/openyurt-deployer
./oy_deploy deploy
3 changes: 3 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
10 changes: 10 additions & 0 deletions scripts/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
module github.com/vhive-serverless/vHive/scripts

go 1.19

require github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485

require (
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/pkg/sftp v1.13.4 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
)
26 changes: 26 additions & 0 deletions scripts/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/pkg/sftp v1.13.4 h1:Lb0RYJCmgUcBgZosfoi9Y9sbl6+LJgOIgk/2Y4YjMFg=
github.com/pkg/sftp v1.13.4/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485 h1:ZMBZ2DKX1sScUSo9ZUwGI7jCMukslPNQNfZaw9vVyfY=
github.com/sfreiberg/simplessh v0.0.0-20220719182921-185eafd40485/go.mod h1:9qeq2P58+4+LyuncL3waJDG+giOfXgowfrRZZF9XdWk=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 1 addition & 3 deletions scripts/openyurt-deployer/conf.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"master": "[email protected]",
"master": "[email protected]",
"workers": {
"cloud": [
"[email protected]"
],
"edge": [
"[email protected]"
]
}
}
2 changes: 2 additions & 0 deletions scripts/openyurt-deployer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func main() {
// printDemo(*deployerConf)
case "deploy-yurt":
deployOpenYurt(*deployerConf)
case "help":
utils.InfoPrintf("Usage: %s <operation: deploy | clean | demo-c | demo-e | demo-clear | demo-print> [Parameters...]\n", os.Args[0])
default:
utils.InfoPrintf("Usage: %s <operation: deploy | clean | demo-c | demo-e | demo-clear | demo-print> [Parameters...]\n", os.Args[0])
os.Exit(-1)
Expand Down
Binary file modified scripts/openyurt-deployer/openyurt_deployer
Binary file not shown.
2 changes: 2 additions & 0 deletions scripts/openyurt-deployer/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ func SetupSSHConn(nodeName string) *simplessh.Client {
splits := strings.Split(nodeName, "@")
username := splits[0]
host := splits[1]
utils.InfoPrintf("Connecting to %s\n", splits[1])
client, err := simplessh.ConnectWithAgent(host, username)
utils.InfoPrintf("CClient info %s\n", client)
if err != nil {
utils.FatalPrintf("Failed to connect to: %s:%s\n", nodeName, err)
}
Expand Down

0 comments on commit 0b3bbdc

Please sign in to comment.