Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pipeline): support for API changes #161

Merged
merged 7 commits into from
Apr 27, 2022
Merged

fix(pipeline): support for API changes #161

merged 7 commits into from
Apr 27, 2022

Conversation

jbrockopp
Copy link
Contributor

@jbrockopp jbrockopp commented Apr 21, 2022

Dependent on go-vela/server#615

Part of the effort for go-vela/community#460

This change updates the Go SDK to support the new and updated API endpoints for pipelines.

The new SDK functions for pipelines that were added with this change are:

sdk-go/vela/pipeline.go

Lines 50 to 51 in 3c213f8

// GetAll returns a list of all pipelines.
func (svc *PipelineService) GetAll(org, repo string, opt *ListOptions) (*[]library.Pipeline, *Response, error) {

sdk-go/vela/pipeline.go

Lines 70 to 71 in 3c213f8

// Add constructs a pipeline with the provided details.
func (svc *PipelineService) Add(org, repo string, h *library.Pipeline) (*library.Pipeline, *Response, error) {

sdk-go/vela/pipeline.go

Lines 84 to 85 in 3c213f8

// Update modifies a pipeline with the provided details.
func (svc *PipelineService) Update(org, repo string, p *library.Pipeline) (*library.Pipeline, *Response, error) {

sdk-go/vela/pipeline.go

Lines 98 to 99 in 3c213f8

// Remove deletes the provided pipeline.
func (svc *PipelineService) Remove(org, repo string, pipeline string) (*string, *Response, error) {

The existing SDK functions for pipelines were updated to accept ref (commit SHA) as a parameter:

sdk-go/vela/pipeline.go

Lines 36 to 39 in 3c213f8

// Get returns the provided pipeline.
func (svc *PipelineService) Get(org, repo, ref string) (*library.Pipeline, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s", org, repo, ref)

sdk-go/vela/pipeline.go

Lines 112 to 115 in 3c213f8

// Compile returns the provided fully compiled pipeline.
func (svc *PipelineService) Compile(org, repo, ref string, opt *PipelineOptions) (*yaml.Build, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s/compile", org, repo, ref)

sdk-go/vela/pipeline.go

Lines 132 to 135 in 3c213f8

// Expand returns the provided pipeline fully compiled.
func (svc *PipelineService) Expand(org, repo, ref string, opt *PipelineOptions) (*yaml.Build, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s/expand", org, repo, ref)

sdk-go/vela/pipeline.go

Lines 152 to 155 in 3c213f8

// Templates returns the provided templates for a pipeline.
func (svc *PipelineService) Templates(org, repo, ref string, opt *PipelineOptions) (map[string]*yaml.Template, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s/templates", org, repo, ref)

sdk-go/vela/pipeline.go

Lines 172 to 175 in 3c213f8

// Validate returns the validation status of the provided pipeline.
func (svc *PipelineService) Validate(org, repo, ref string, opt *PipelineOptions) (*string, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s/validate", org, repo, ref)

@jbrockopp jbrockopp self-assigned this Apr 21, 2022
cognifloyd
cognifloyd previously approved these changes Apr 21, 2022
@jbrockopp jbrockopp added the bug Indicates a bug label Apr 21, 2022
@codecov
Copy link

codecov bot commented Apr 22, 2022

Codecov Report

Merging #161 (3c213f8) into master (e7dd7ee) will increase coverage by 0.32%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #161      +/-   ##
==========================================
+ Coverage   89.46%   89.79%   +0.32%     
==========================================
  Files          18       18              
  Lines        1396     1440      +44     
==========================================
+ Hits         1249     1293      +44     
  Misses        107      107              
  Partials       40       40              
Impacted Files Coverage Δ
vela/pipeline.go 77.61% <100.00%> (+10.94%) ⬆️

@jbrockopp jbrockopp marked this pull request as ready for review April 26, 2022 18:52
@jbrockopp jbrockopp requested a review from a team as a code owner April 26, 2022 18:52
@@ -6,8 +6,8 @@ require (
github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3
github.com/coreos/go-semver v0.3.0
github.com/gin-gonic/gin v1.7.7
github.com/go-vela/server v0.13.0
github.com/go-vela/types v0.13.0
github.com/go-vela/server v0.13.2-0.20220426180142-90727d2b465a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting. where is it getting v0.13.2 from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that comes from the Go module system when pulling a dependency based on a commit.

Go sees the v0.13.1 release is out there, but I'm vendoring from a commit published after that release.

So the system automatically updates to the next available patch release (v0.13.2).

What follows after that patch is the time and date (20220426180142).

And lastly, the shortened commit SHA that was vendored in (90727d2b465a).

Copy link

@kneal kneal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐬

@wass3r wass3r merged commit ec46488 into master Apr 27, 2022
@wass3r wass3r deleted the fix/pipeline branch April 27, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants