Skip to content

Commit

Permalink
Added major patch
Browse files Browse the repository at this point in the history
Signed-off-by: jagpreetsinghsasan <[email protected]>
  • Loading branch information
jagpreetsinghsasan committed Mar 19, 2024
1 parent 74751af commit 2e30533
Show file tree
Hide file tree
Showing 22 changed files with 1,658 additions and 33 deletions.
13 changes: 7 additions & 6 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
"minWordLength": 4,
"allowCompoundWords": true,
"words": [
"outsh",
"adminpw",
"Albertirsa",
"ALLFORTX",
"Anoncreds",
"anoncreds",
"Anoncreds",
"ANYFORTX",
"APIV",
"Apim",
"APIV",
"approveformyorg",
"Askar",
"askar",
"Askar",
"Authz",
"authzn",
"AWSSM",
Expand Down Expand Up @@ -47,8 +46,8 @@
"data",
"dclm",
"DHTAPI",
"Dids",
"dids",
"Dids",
"DockerOde",
"ealen",
"ecparams",
Expand Down Expand Up @@ -80,8 +79,8 @@
"ipaddress",
"ipfs",
"IPFSHTTP",
"IPLD",
"ipld",
"IPLD",
"Iroha",
"Irohad",
"isready",
Expand Down Expand Up @@ -127,6 +126,7 @@
"organisation",
"Orgs",
"ossp",
"outsh",
"parameterizable",
"Postgres",
"proto",
Expand Down Expand Up @@ -155,6 +155,7 @@
"thream",
"tlsca",
"tlscacerts",
"tpls",
"txid",
"txqueue",
"Uisrs",
Expand Down
9 changes: 9 additions & 0 deletions examples/bevel/configure/bevel_config_template.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package configure

type BevelConfig struct {
LedgerType string `json:"LedgerType"`
GitUrl string `json:"GitUrl"`
GitUserName string `json:"GitUserName"`
GitToken string `json:"GitToken"`
GitUserEmail string `json:"GitUserEmail"`
}
47 changes: 47 additions & 0 deletions examples/bevel/configure/configure_local_repo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package configure

import (
"fmt"
"os"

"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/hyperledger/cacti/examples/bevel/utils"
"go.uber.org/zap"
)

const (
BevelRemoteUrl = "https://github.com/hyperledger/bevel.git"
BevelRemoteName = "BevelRemoteForCacti"
BevelBranchName = "cactibevelexample"
)

func DownloadBevelRepo(gitUrl string, gitUsername string, gitToken string, logger *zap.Logger){
logger.Info("Deleting any previous instances of repository present on the ./repo path")
errRemoveRepo := os.RemoveAll("./repo")
if errRemoveRepo != nil {
logger.Error(fmt.Sprint(errRemoveRepo))
}


logger.Info("Cloning the bevel repository")
_, err := git.PlainClone("repo", false, &git.CloneOptions{
URL: gitUrl,
Auth: &http.BasicAuth{
Username: gitUsername,
Password: gitToken,
},
Progress: os.Stdout,
})

if err != nil {
logger.Error(fmt.Sprint(err))
}
}

func CreateBranchFromBevelRemote(logger *zap.Logger) {
utils.ExecuteCmd([]string{"git", "-C", "./repo/", "remote", "add", "bevel", BevelRemoteUrl}, false, logger)
utils.ExecuteCmd([]string{"git", "-C", "./repo/", "fetch", "bevel", "tag", "v1.0.0.0", "--no-tags"}, false, logger)
utils.ExecuteCmd([]string{"git", "-C", "./repo/", "checkout", "-b", BevelBranchName, "v1.0.0.0"}, false, logger)
utils.ExecuteCmd([]string{"git", "-C", "./repo/", "push", "--set-upstream", "origin", "cactibevelexample", "--force"}, true, logger)
}
28 changes: 28 additions & 0 deletions examples/bevel/configure/read_bevel_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package configure

import (
"encoding/json"
"fmt"
"os"
"go.uber.org/zap"
)

func ReadBevelConfig(bevelConfigFileAbsPath string, logger *zap.Logger) BevelConfig{
logger.Info("Reading file contents from: " + bevelConfigFileAbsPath)

file, err := os.Open(bevelConfigFileAbsPath)
if err != nil {
logger.Error(fmt.Sprint(err))
}
defer file.Close()

var bevelConfig BevelConfig
decoder := json.NewDecoder(file)
err = decoder.Decode(&bevelConfig)
if err != nil {
logger.Error(fmt.Sprint(err))
}

return bevelConfig
}

58 changes: 54 additions & 4 deletions examples/bevel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,79 @@ module github.com/hyperledger/cacti/examples/bevel

go 1.21.6

require (
github.com/Masterminds/sprig/v3 v3.2.3
github.com/go-git/go-git/v5 v5.11.0
go.uber.org/zap v1.26.0
k8s.io/api v0.24.17
k8s.io/apimachinery v0.24.17
k8s.io/client-go v0.24.17
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.11.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 2e30533

Please sign in to comment.