This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebcf4fe
commit 8747bfc
Showing
32 changed files
with
1,144 additions
and
806 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/samcontesse/gitlab-merge-request-resource/pkg" | ||
"github.com/samcontesse/gitlab-merge-request-resource/pkg/check" | ||
"github.com/xanzy/go-gitlab" | ||
"os" | ||
) | ||
|
||
func main() { | ||
|
||
var request check.Request | ||
inputRequest(&request) | ||
|
||
client, err := gitlab.NewClient(request.Source.PrivateToken, gitlab.WithHTTPClient(pkg.GetDefaultClient(request.Source.Insecure)), gitlab.WithBaseURL(request.Source.GetBaseURL())) | ||
if err != nil { | ||
pkg.Fatal("initializing gitlab client", err) | ||
} | ||
|
||
command := check.NewCommand(client) | ||
response, err := command.Run(request) | ||
if err != nil { | ||
pkg.Fatal("running command", err) | ||
} | ||
|
||
outputResponse(response) | ||
} | ||
|
||
func inputRequest(request *check.Request) { | ||
if err := json.NewDecoder(os.Stdin).Decode(request); err != nil { | ||
pkg.Fatal("reading request from stdin", err) | ||
} | ||
} | ||
|
||
func outputResponse(response check.Response) { | ||
if err := json.NewEncoder(os.Stdout).Encode(response); err != nil { | ||
pkg.Fatal("writing response to stdout", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/samcontesse/gitlab-merge-request-resource/pkg" | ||
"github.com/samcontesse/gitlab-merge-request-resource/pkg/in" | ||
"github.com/xanzy/go-gitlab" | ||
"os" | ||
) | ||
|
||
func main() { | ||
|
||
if len(os.Args) < 2 { | ||
println("usage: " + os.Args[0] + " <destination>") | ||
os.Exit(1) | ||
} | ||
|
||
destination := os.Args[1] | ||
|
||
var request in.Request | ||
inputRequest(&request) | ||
|
||
client, err := gitlab.NewClient(request.Source.PrivateToken, gitlab.WithHTTPClient(pkg.GetDefaultClient(request.Source.Insecure)), gitlab.WithBaseURL(request.Source.GetBaseURL())) | ||
if err != nil { | ||
pkg.Fatal("initializing gitlab client", err) | ||
} | ||
|
||
command := in.NewCommand(client) | ||
response, err := command.Run(destination, request) | ||
if err != nil { | ||
pkg.Fatal("running command", err) | ||
} | ||
|
||
outputResponse(response) | ||
} | ||
|
||
func inputRequest(request *in.Request) { | ||
if err := json.NewDecoder(os.Stdin).Decode(request); err != nil { | ||
pkg.Fatal("reading request from stdin", err) | ||
} | ||
} | ||
|
||
func outputResponse(response in.Response) { | ||
if err := json.NewEncoder(os.Stdout).Encode(response); err != nil { | ||
pkg.Fatal("writing response to stdout", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/samcontesse/gitlab-merge-request-resource/pkg" | ||
"github.com/samcontesse/gitlab-merge-request-resource/pkg/out" | ||
"github.com/xanzy/go-gitlab" | ||
"os" | ||
) | ||
|
||
func main() { | ||
|
||
if len(os.Args) < 2 { | ||
println("usage: " + os.Args[0] + " <destination>") | ||
os.Exit(1) | ||
} | ||
|
||
destination := os.Args[1] | ||
|
||
var request out.Request | ||
inputRequest(&request) | ||
|
||
client, err := gitlab.NewClient(request.Source.PrivateToken, gitlab.WithHTTPClient(pkg.GetDefaultClient(request.Source.Insecure)), gitlab.WithBaseURL(request.Source.GetBaseURL())) | ||
if err != nil { | ||
pkg.Fatal("initializing gitlab client", err) | ||
} | ||
|
||
command := out.NewCommand(client) | ||
response, err := command.Run(destination, request) | ||
if err != nil { | ||
pkg.Fatal("running command", err) | ||
} | ||
|
||
outputResponse(response) | ||
} | ||
|
||
func inputRequest(request *out.Request) { | ||
if err := json.NewDecoder(os.Stdin).Decode(request); err != nil { | ||
pkg.Fatal("reading request from stdin", err) | ||
} | ||
} | ||
|
||
func outputResponse(response out.Response) { | ||
if err := json.NewEncoder(os.Stdout).Encode(response); err != nil { | ||
pkg.Fatal("writing response to stdout", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
module github.com/samcontesse/gitlab-merge-request-resource | ||
|
||
go 1.17 | ||
|
||
require ( | ||
github.com/fsnotify/fsnotify v1.5.1 // indirect | ||
github.com/onsi/ginkgo/v2 v2.1.1 | ||
github.com/onsi/gomega v1.18.1 | ||
github.com/xanzy/go-gitlab v0.54.4 | ||
) | ||
|
||
require ( | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/google/go-querystring v1.1.0 // indirect | ||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect | ||
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect | ||
github.com/onsi/ginkgo v1.16.5 | ||
github.com/onsi/gomega v1.17.0 | ||
github.com/xanzy/go-gitlab v0.54.3 | ||
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect | ||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect | ||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect | ||
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect | ||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/protobuf v1.27.1 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
) | ||
|
||
go 1.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.