This is an automated email from the ASF dual-hosted git repository. msciabarra pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit cb3187aecdba779e184c680e848be8b1bc3941b3 Author: Michele Sciabarra <[email protected]> AuthorDate: Thu Jul 18 12:49:23 2024 +0200 work-in-progress wsk and wskdeploy --- .gitmodules | 12 +- Taskfile.yml | 3 +- go.mod | 40 ++-- go.sum | 88 +++++--- patches/.gitignore | 4 + patches/README.md | 40 +++- patches/patch-task.sh | 2 +- patches/{patch-task.sh => patch-wsk.sh} | 0 patches/{patch-task.sh => patch-wskdeploy.sh} | 20 +- patches/runtimes.go | 291 ++++++++++++++++++++++++++ patches/runtimes_extra.go | 108 ++++++++++ tools/global.go | 12 ++ tools/task | 2 +- tools/wsk | 1 + tools/wskdeploy | 1 + 15 files changed, 544 insertions(+), 80 deletions(-) diff --git a/.gitmodules b/.gitmodules index d7dc5e0..f6f96cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,12 +6,6 @@ path = tools/sh url = https://github.com/sciabarracom/sh branch = openserverless -[submodule "tools/wsk"] - path = tools/wsh - url = https://github.com/sciabarracom/openwhisk-cli -[submodule "tools/wskdeploy"] - path = tools/wskdeploy - url = https://github.com/sciabarracom/openwhisk-cli [submodule "openserverless-task"] path = openserverless-task url = https://github.com/apache/openserverless-task @@ -28,3 +22,9 @@ path = tools/envsubst url = https://github.com/nuvolaris/envsubst branch = openserverless +[submodule "tools/wsk"] + path = tools/wsk + url = https://github.com/sciabarracom/openwhisk-cli +[submodule "tools/wskdeploy"] + path = tools/wskdeploy + url = https://github.com/sciabarracom/openwhisk-wskdeploy diff --git a/Taskfile.yml b/Taskfile.yml index 66c4bb3..0fb8810 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -27,7 +27,8 @@ vars: tasks: default: - - task: build + - task -l + cli-ver: - task: update-runtimes diff --git a/go.mod b/go.mod index 6d1d571..d38acf1 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,14 @@ module github.com/nuvolaris/nuv -go 1.21 +go 1.21.0 + +toolchain go1.21.11 require ( github.com/apache/openwhisk-client-go v0.0.0-20230421081559-13fc65f65684 github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 github.com/go-git/go-git/v5 v5.9.0 + github.com/go-task/task/v3 v3.38.0 github.com/itchyny/gojq v0.12.13 github.com/mitchellh/go-homedir v1.1.0 github.com/nicksnyder/go-i18n v1.10.1 @@ -15,7 +18,16 @@ require ( github.com/nuvolaris/gron v0.0.0-20231020134423-84e679ea6aad github.com/nuvolaris/someutils v0.0.0-20230406090008-39e94b70e1ae github.com/nuvolaris/task/v3 v3.30.2-nuv.2309151614 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 + mvdan.cc/sh/v3 v3.8.0 +) + +require ( + github.com/Ladicle/tabwriter v1.0.0 // indirect + github.com/alecthomas/chroma/v2 v2.14.0 // indirect + github.com/dominikbraun/graph v0.23.0 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect + github.com/go-task/template v0.0.0-20240602015157-960e6f576656 // indirect ) require ( @@ -43,8 +55,8 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/tidwall/sjson v1.2.4 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/tools v0.17.0 // indirect ) require ( @@ -60,9 +72,9 @@ require ( github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/dlclark/regexp2 v1.10.0 // indirect + github.com/dlclark/regexp2 v1.11.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect @@ -83,7 +95,7 @@ require ( github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/laher/uggo v0.0.0-20140418102112-0ad25fe11c5b // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 + github.com/mattn/go-isatty v0.0.20 github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-zglob v0.0.4 // indirect github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect @@ -98,16 +110,16 @@ require ( github.com/sergi/go-diff v1.3.1 // indirect github.com/skeema/knownhosts v1.2.0 // indirect github.com/spf13/cobra v1.7.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/pflag v1.0.5 github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/zalando/go-keyring v0.2.3 - golang.org/x/crypto v0.13.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/net v0.15.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/term v0.12.0 - golang.org/x/text v0.13.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 + golang.org/x/text v0.14.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index ef3138f..2dc68e5 100644 --- a/go.sum +++ b/go.sum @@ -15,6 +15,8 @@ dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Ladicle/tabwriter v1.0.0 h1:DZQqPvMumBDwVNElso13afjYLNp0Z7pHqHnu0r4t9Dg= +github.com/Ladicle/tabwriter v1.0.0/go.mod h1:c4MdCjxQyTbGuQO/gvqJ+IA/89UEwrsD6hUCW98dyp4= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= @@ -33,6 +35,12 @@ github.com/a8m/envsubst v1.4.2 h1:4yWIHXOLEJHQEFd4UjrWDrYeYlV7ncFWJOCBRLOZHQg= github.com/a8m/envsubst v1.4.2/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= +github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE= +github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E= +github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0= @@ -71,8 +79,8 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= -github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0= +github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= @@ -84,20 +92,22 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8Yc github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= -github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/dominikbraun/graph v0.23.0 h1:TdZB4pPqCLFxYhdyMFb1TBdFxp8XLcJfTTBQucVPgCo= +github.com/dominikbraun/graph v0.23.0/go.mod h1:yOjYyogZLY1LSG9E33JWZJiq5k83Qy2C6POAuiViluc= github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA= -github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -123,6 +133,12 @@ github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5Nq github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v2.20.0+incompatible h1:4Xh3bDzO29j4TWNOI+24ubc0vbVFMg2PMnXKxK54/CA= github.com/go-task/slim-sprig v2.20.0+incompatible/go.mod h1:N/mhXZITr/EQAOErEHciKvO1bFei2Lld2Ym6h96pdy0= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/go-task/task/v3 v3.38.0 h1:O7kgA6BfwktXHPrheByQO46p3teKtRuq1EpGnFxNzbo= +github.com/go-task/task/v3 v3.38.0/go.mod h1:UzLDHoXTKNAtWwFP3WVsfMhlSw3K8i9KNzEO9kCHix8= +github.com/go-task/template v0.0.0-20240602015157-960e6f576656 h1:knZZ4zVdTBQnevBz0zSES++4Mr7wr+cHopLvHabIgkA= +github.com/go-task/template v0.0.0-20240602015157-960e6f576656/go.mod h1:RgwRaZK+kni/hJJ7/AaOE2lPQFPbAdji/DyhC6pxo4k= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -150,8 +166,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= @@ -193,6 +209,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI= github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f h1:7LYC+Yfkj3CTRcShK0KOL/w6iTiKyqqBA9a41Wnggw8= github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI= @@ -252,8 +270,8 @@ github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-zglob v0.0.4 h1:LQi2iOm0/fGgu80AioIJ/1j9w9Oh+9DZ39J4VAGzHQM= @@ -366,8 +384,8 @@ github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= @@ -402,14 +420,14 @@ github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.0 h1:6aeJ0bzojgWLa82gDQHcx3S0Lr/O51I9bJ5nv6JFx5w= @@ -450,8 +468,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -475,8 +493,8 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -502,8 +520,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -515,8 +533,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -558,16 +576,16 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -580,8 +598,8 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -605,8 +623,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -668,4 +686,6 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +mvdan.cc/sh/v3 v3.8.0 h1:ZxuJipLZwr/HLbASonmXtcvvC9HXY9d2lXZHnKGjFc8= +mvdan.cc/sh/v3 v3.8.0/go.mod h1:w04623xkgBVo7/IUK89E0g8hBykgEpN0vgOj3RJr6MY= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/patches/.gitignore b/patches/.gitignore new file mode 100644 index 0000000..bfd6871 --- /dev/null +++ b/patches/.gitignore @@ -0,0 +1,4 @@ +task +gosh +wsk +wskdeploy diff --git a/patches/README.md b/patches/README.md index a792728..ede0849 100644 --- a/patches/README.md +++ b/patches/README.md @@ -1,17 +1,39 @@ +# Patches: -This is the procedure we followed to build the patched versions of: +- changes to mvdan/sh: + - rename to sciabarracom/sh + - use coreutils as builtins + - use ops tools as builtin +- changes to taskfile: + - rename to sciabarracom/task + - default taskfile is opsfile.yml + - use the patched mvdan shell +- changes to openwhisk-wskdeploy: + - rename to sciabarracom/openwhisk-wskdeploy + - use a different path for retrieving the configuration (api/info instead of the root of the APIHOST) + - wire a different default runtimesjson +- changes to openwhisk-wsk + - rename to sciabarracom/openwhisk-wskdeploy + - generate and add to the sources the translation resources to build as a library + - use the patched openwhisk-wskdeploy + +# Procedure - github.com/go-task/task -> github.com/sciabarracom/task - mvdan.cc/sh -> github.com/sciabarracom/sh +This is the procedure we followed to build the patched versions of: 1. fork mvdan.cc/sh in github.com/sciabarracom/sh fork github.com/go-task/task in github.com/sciabarracom/task + fork github.com/apache/openwhisk-cli in github.com/sciabarracom/openwhisk-cli + fork github.com/apache/openwhisk-wskdeploy in github.com/sciabarracom/openwhisk-wskdeploy -2. checkout v3.8.0 for sh and v3.38.0 for task as openserverless branch and set openserverless as the default branch - -4. git submodule update --init, then add orig-auth to both with an authentication token so you can push it +3. git submodule update --init, + then add remote orig-auth ian authentication token so you can push it back + then add remote upstream to the original repos to fetch tags + then git fetch --all -5. bash patch-sh.sh - bash patch-task.sk +3. execute the patch scripts in order -to patch and push + bash patch-sh.sh + bash patch-task.sh + bash patch-wskdeploy.sh + bash patch-wsk.sh diff --git a/patches/patch-task.sh b/patches/patch-task.sh index efee39a..de597da 100644 --- a/patches/patch-task.sh +++ b/patches/patch-task.sh @@ -5,7 +5,7 @@ HERE=$PWD STAG="v3.38.0" DTAG="$STAG-openserverless" cd ../tools/task -git checkout "$TAG" -B openserverless +git checkout "$STAG" -B openserverless mkdir -p cmd/taskmain cat cmd/task/task.go \ | sed -e 's/package main/package taskmain/' \ diff --git a/patches/patch-task.sh b/patches/patch-wsk.sh similarity index 100% copy from patches/patch-task.sh copy to patches/patch-wsk.sh diff --git a/patches/patch-task.sh b/patches/patch-wskdeploy.sh similarity index 51% copy from patches/patch-task.sh copy to patches/patch-wskdeploy.sh index efee39a..92f313f 100644 --- a/patches/patch-task.sh +++ b/patches/patch-wskdeploy.sh @@ -2,24 +2,16 @@ cd "$(dirname $0)" # any suggestion how to avoid this rename and use just replaces in go.mod is welcome HERE=$PWD -STAG="v3.38.0" +STAG="1.2.0" DTAG="$STAG-openserverless" -cd ../tools/task -git checkout "$TAG" -B openserverless -mkdir -p cmd/taskmain -cat cmd/task/task.go \ -| sed -e 's/package main/package taskmain/' \ -| sed -e 's/func main() {/func Task(_args []string) { os.Args = _args/' \ -| tee cmd/taskmain/task.go -cp $HERE/task.go cmd/taskmain/task.go -git add cmd/taskmain/task.go +cd ../tools/wskdeploy +git checkout "$STAG" -B openserverless + find . \( -name \*.go -o -name go.mod \) | while read file do echo $file - sed -i "s!go-task/task!sciabarracom/task!" $file - sed -i 's!mvdan.sh/cc!sciabarracom/sh!' $file - sed -i 's!"Taskfile.!"opsfile.!' $file - sed -i 's!task: !ops: !' $file + sed -i "s!apache/openwhisk-wskdeploy!sciabarracom/openwhisk-wskdeploy!" $file done + go clean -modcache -cache -testcache -fuzzcache go mod tidy git commit -m "patching sh for ops" -a diff --git a/patches/runtimes.go b/patches/runtimes.go new file mode 100644 index 0000000..f6754d7 --- /dev/null +++ b/patches/runtimes.go @@ -0,0 +1,291 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package runtimes + +import ( + "crypto/tls" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "os" + "strings" + "time" + + "github.com/apache/openwhisk-client-go/whisk" + "github.com/nuvolaris/openwhisk-wskdeploy/utils" + "github.com/nuvolaris/openwhisk-wskdeploy/wskderrors" + "github.com/nuvolaris/openwhisk-wskdeploy/wski18n" + "github.com/nuvolaris/openwhisk-wskdeploy/wskprint" +) + +const ( + NODEJS_FILE_EXTENSION = "js" + SWIFT_FILE_EXTENSION = "swift" + PYTHON_FILE_EXTENSION = "py" + JAVA_FILE_EXTENSION = "java" + JAR_FILE_EXTENSION = "jar" + CSHARP_FILE_EXTENSION = "cs" + PHP_FILE_EXTENSION = "php" + ZIP_FILE_EXTENSION = "zip" + RUBY_FILE_EXTENSION = "rb" + GO_FILE_EXTENSION = "go" + RUST_FILE_EXTENSION = "rs" + NODEJS_RUNTIME = "nodejs" + SWIFT_RUNTIME = SWIFT_FILE_EXTENSION + PYTHON_RUNTIME = "python" + JAVA_RUNTIME = JAVA_FILE_EXTENSION + DOTNET_RUNTIME = ZIP_FILE_EXTENSION + PHP_RUNTIME = PHP_FILE_EXTENSION + RUBY_RUNTIME = "ruby" + GO_RUNTIME = GO_FILE_EXTENSION + RUST_RUNTIME = "rust" + HTTP_CONTENT_TYPE_KEY = "Content-Type" + HTTP_CONTENT_TYPE_VALUE = "application/json; charset=UTF-8" + RUNTIME_NOT_SPECIFIED = "NOT SPECIFIED" + BLACKBOX = "blackbox" + HTTPS = "https://" +) + +// Structs used to denote the OpenWhisk Runtime information +type Limit struct { + Apm uint `json:"actions_per_minute"` + Tpm uint `json:"triggers_per_minute"` + ConAction uint `json:"concurrent_actions"` +} + +type Runtime struct { + Deprecated bool `json:"deprecated"` + Default bool `json:"default"` + Kind string `json:"kind"` +} + +type SupportInfo struct { + Github string `json:"github"` + Slack string `json:"slack"` +} + +type OpenWhiskInfo struct { + Support SupportInfo `json:"support"` + Desc string `json:"description"` + ApiPath []string `json:"api_paths"` + Runtimes map[string][]Runtime `json:"runtimes"` + Limits Limit `json:"limits"` +} + +var FileExtensionRuntimeKindMap map[string]string +var SupportedRunTimes map[string][]string +var DefaultRunTimes map[string]string +var FileRuntimeExtensionsMap map[string]string + +func GetRuntimesByUrl(opURL string, pop *OpenWhiskInfo) error { + + // configure transport + tlsConfig := &tls.Config{ + InsecureSkipVerify: true, + } + var netTransport = &http.Transport{ + TLSClientConfig: tlsConfig, + } + + var netClient = &http.Client{ + Timeout: time.Second * utils.DEFAULT_HTTP_TIMEOUT, + Transport: netTransport, + } + + req, _ := http.NewRequest("GET", opURL, nil) + req.Header.Set(HTTP_CONTENT_TYPE_KEY, HTTP_CONTENT_TYPE_VALUE) + whisk.Debug(whisk.DbgInfo, "trying "+req.URL.String()) + res, err := netClient.Do(req) + if err != nil { + // TODO() create an error + errString := wski18n.T(wski18n.ID_ERR_RUNTIMES_GET_X_err_X, + map[string]interface{}{"err": err.Error()}) + whisk.Debug(whisk.DbgWarn, errString) + if utils.Flags.Strict { + errMessage := wski18n.T(wski18n.ID_ERR_RUNTIME_PARSER_ERROR, + map[string]interface{}{wski18n.KEY_ERR: err.Error()}) + err = wskderrors.NewRuntimeParserError(errMessage) + } + return err + } else { + if res != nil { + defer res.Body.Close() + } + b, _ := ioutil.ReadAll(res.Body) + if b != nil && len(b) > 0 { + stdout := wski18n.T(wski18n.ID_MSG_UNMARSHAL_NETWORK_X_url_X, + map[string]interface{}{"url": opURL}) + wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout) + return json.Unmarshal(b, pop) + } + return fmt.Errorf("cannot get runtimes") + } +} + +// We could get the openwhisk info from bluemix through running the command +// `curl -k https://openwhisk.ng.bluemix.net` +// hard coding it here in case of network unavailable or failure. +func ParseOpenWhisk(apiHost string) (op OpenWhiskInfo, err error) { + opURL := apiHost + _, err = url.ParseRequestURI(opURL) + if err != nil { + opURL = HTTPS + opURL + } + + // trying to download info + err = GetRuntimesByUrl(opURL+"/api/info", &op) + if err != nil { + err = GetRuntimesByUrl(opURL, &op) + } + if err != nil { + stdout := wski18n.T(wski18n.ID_MSG_UNMARSHAL_LOCAL) + wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout) + runtimes := []byte(os.Getenv("WSK_RUNTIMES_JSON")) + err = json.Unmarshal(runtimes, &op) + if err != nil { + fmt.Printf("cannot parse this json: ===\n%s\n===\n", runtimes) + return + } + } + return +} + +func ConvertToMap(op OpenWhiskInfo) (rt map[string][]string) { + rt = make(map[string][]string) + for k, v := range op.Runtimes { + rt[k] = make([]string, 0, len(v)) + for i := range v { + if !v[i].Deprecated { + rt[k] = append(rt[k], v[i].Kind) + } + if v[i].Default { + rt[k] = append(rt[k], strings.Split(v[i].Kind, ":")[0]+":default") + } + } + } + return +} + +func DefaultRuntimes(op OpenWhiskInfo) (rt map[string]string) { + rt = make(map[string]string) + for k, v := range op.Runtimes { + for i := range v { + if !v[i].Deprecated { + if v[i].Default { + rt[k] = v[i].Kind + } + } + } + } + return +} + +func FileExtensionRuntimes(op OpenWhiskInfo) (ext map[string]string) { + ext = make(map[string]string) + for k := range op.Runtimes { + if strings.Contains(k, NODEJS_RUNTIME) { + ext[NODEJS_FILE_EXTENSION] = k + } else if strings.Contains(k, PYTHON_RUNTIME) { + ext[PYTHON_FILE_EXTENSION] = k + } else if strings.Contains(k, SWIFT_RUNTIME) { + ext[SWIFT_FILE_EXTENSION] = k + } else if strings.Contains(k, PHP_RUNTIME) { + ext[PHP_FILE_EXTENSION] = k + } else if strings.Contains(k, JAVA_RUNTIME) { + ext[JAVA_FILE_EXTENSION] = k + ext[JAR_FILE_EXTENSION] = k + } else if strings.Contains(k, RUBY_RUNTIME) { + ext[RUBY_FILE_EXTENSION] = k + } else if strings.Contains(k, RUST_RUNTIME) { + ext[RUST_FILE_EXTENSION] = k + } else if strings.Contains(k, GO_RUNTIME) { + ext[GO_FILE_EXTENSION] = k + } else if strings.Contains(k, DOTNET_RUNTIME) { + ext[CSHARP_FILE_EXTENSION] = k + ext[ZIP_FILE_EXTENSION] = k + } else if strings.Contains(k, RUST_RUNTIME) { + ext[RUST_FILE_EXTENSION] = k + } + } + return +} + +func FileRuntimeExtensions(op OpenWhiskInfo) (rte map[string]string) { + rte = make(map[string]string) + + for k, v := range op.Runtimes { + for i := range v { + if !v[i].Deprecated { + if strings.Contains(k, NODEJS_RUNTIME) { + rte[v[i].Kind] = NODEJS_FILE_EXTENSION + } else if strings.Contains(k, PYTHON_RUNTIME) { + rte[v[i].Kind] = PYTHON_FILE_EXTENSION + } else if strings.Contains(k, SWIFT_RUNTIME) { + rte[v[i].Kind] = SWIFT_FILE_EXTENSION + } else if strings.Contains(k, PHP_RUNTIME) { + rte[v[i].Kind] = PHP_FILE_EXTENSION + } else if strings.Contains(k, JAVA_RUNTIME) { + rte[v[i].Kind] = JAVA_FILE_EXTENSION + } else if strings.Contains(k, RUBY_RUNTIME) { + rte[v[i].Kind] = RUBY_FILE_EXTENSION + } else if strings.Contains(k, RUST_RUNTIME) { + rte[v[i].Kind] = RUST_FILE_EXTENSION + } else if strings.Contains(k, GO_RUNTIME) { + rte[v[i].Kind] = GO_FILE_EXTENSION + } else if strings.Contains(k, DOTNET_RUNTIME) { + rte[v[i].Kind] = CSHARP_FILE_EXTENSION + } else if strings.Contains(k, RUST_RUNTIME) { + rte[v[i].Kind] = RUST_FILE_EXTENSION + } + } + } + } + return +} + +func CheckRuntimeConsistencyWithFileExtension(ext string, runtime string) bool { + rt := FileExtensionRuntimeKindMap[ext] + for _, v := range SupportedRunTimes[rt] { + if runtime == v { + return true + } + } + return false +} + +func CheckExistRuntime(rtname string, runtimes map[string][]string) bool { + for _, v := range runtimes { + for i := range v { + if rtname == v[i] { + return true + } + } + } + return false +} + +func ListOfSupportedRuntimes(runtimes map[string][]string) (rt []string) { + for _, v := range runtimes { + for _, t := range v { + rt = append(rt, t) + } + } + return +} diff --git a/patches/runtimes_extra.go b/patches/runtimes_extra.go new file mode 100644 index 0000000..55e6d9b --- /dev/null +++ b/patches/runtimes_extra.go @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package runtimes + +import ( + "crypto/tls" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "os" + "time" + + "github.com/apache/openwhisk-client-go/whisk" + "github.com/apache/openwhisk-wskdeploy/utils" + "github.com/apache/openwhisk-wskdeploy/wskderrors" + "github.com/apache/openwhisk-wskdeploy/wski18n" + "github.com/apache/openwhisk-wskdeploy/wskprint" +) + +func GetRuntimesByUrl(opURL string, pop *OpenWhiskInfo) error { + + // configure transport + tlsConfig := &tls.Config{ + InsecureSkipVerify: true, + } + var netTransport = &http.Transport{ + TLSClientConfig: tlsConfig, + } + + var netClient = &http.Client{ + Timeout: time.Second * utils.DEFAULT_HTTP_TIMEOUT, + Transport: netTransport, + } + + req, _ := http.NewRequest("GET", opURL, nil) + req.Header.Set(HTTP_CONTENT_TYPE_KEY, HTTP_CONTENT_TYPE_VALUE) + whisk.Debug(whisk.DbgInfo, "trying "+req.URL.String()) + res, err := netClient.Do(req) + if err != nil { + // TODO() create an error + errString := wski18n.T(wski18n.ID_ERR_RUNTIMES_GET_X_err_X, + map[string]interface{}{"err": err.Error()}) + whisk.Debug(whisk.DbgWarn, errString) + if utils.Flags.Strict { + errMessage := wski18n.T(wski18n.ID_ERR_RUNTIME_PARSER_ERROR, + map[string]interface{}{wski18n.KEY_ERR: err.Error()}) + err = wskderrors.NewRuntimeParserError(errMessage) + } + return err + } else { + if res != nil { + defer res.Body.Close() + } + b, _ := ioutil.ReadAll(res.Body) + if b != nil && len(b) > 0 { + stdout := wski18n.T(wski18n.ID_MSG_UNMARSHAL_NETWORK_X_url_X, + map[string]interface{}{"url": opURL}) + wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout) + return json.Unmarshal(b, pop) + } + return fmt.Errorf("cannot get runtimes") + } +} + +// We could get the openwhisk info from bluemix through running the command +// `curl -k https://openwhisk.ng.bluemix.net` +// hard coding it here in case of network unavailable or failure. +func ParseOpenWhisk(apiHost string) (op OpenWhiskInfo, err error) { + opURL := apiHost + _, err = url.ParseRequestURI(opURL) + if err != nil { + opURL = HTTPS + opURL + } + + // trying to download info + err = GetRuntimesByUrl(opURL+"/api/info", &op) + if err != nil { + err = GetRuntimesByUrl(opURL, &op) + } + if err != nil { + stdout := wski18n.T(wski18n.ID_MSG_UNMARSHAL_LOCAL) + wskprint.PrintOpenWhiskVerbose(utils.Flags.Verbose, stdout) + runtimes := []byte(os.Getenv("WSK_RUNTIMES_JSON")) + err = json.Unmarshal(runtimes, &op) + if err != nil { + fmt.Printf("cannot parse this json: ===\n%s\n===\n", runtimes) + return + } + } + return +} diff --git a/tools/global.go b/tools/global.go new file mode 100644 index 0000000..7194178 --- /dev/null +++ b/tools/global.go @@ -0,0 +1,12 @@ +package tools + +var Tools = []string{ + "awk", "die", "jq", "js", + "envsubst", "wsk", "mkdir", + "filetype", "random", "datefmt", + "config", "retry", "urlenc", + "replace", "base64", "validate", + "echoif", "echoifempty", "echoifexists", + "realpath", "zipf", "needupdate", + "gron", "jj", "deploy", +} diff --git a/tools/task b/tools/task index 8a3c8cc..d6277bd 160000 --- a/tools/task +++ b/tools/task @@ -1 +1 @@ -Subproject commit 8a3c8cc57237a90790c28c1b2f3dec46bd689beb +Subproject commit d6277bd28a5fdebf407623e182b6156b21261253 diff --git a/tools/wsk b/tools/wsk new file mode 160000 index 0000000..b1ca4bc --- /dev/null +++ b/tools/wsk @@ -0,0 +1 @@ +Subproject commit b1ca4bccc2c256a073ffc114913c43d78f412830 diff --git a/tools/wskdeploy b/tools/wskdeploy new file mode 160000 index 0000000..03df112 --- /dev/null +++ b/tools/wskdeploy @@ -0,0 +1 @@ +Subproject commit 03df1126c3b5205d642738479a08bb7cd66a03b3
