From f1d319c80558fa2d12cb69eeea98e3391a4a4afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=99=93=E4=BC=9F?= Date: Thu, 5 Oct 2023 20:18:47 +0800 Subject: [PATCH] :arrow_up: github.com/xanzy/go-gitlab from v0.92.3 to v0.93.0 use SDK https://jihulab.com/xuxiaowei-com-cn/gitlab-go/-/issues/5 --- go.mod | 2 +- go.sum | 4 ++-- job_artifacts/job_artifacts.go | 18 ++---------------- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 6474dea..eab6ff3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/urfave/cli/v2 v2.25.7 - github.com/xanzy/go-gitlab v0.92.3 + github.com/xanzy/go-gitlab v0.93.0 github.com/xuxiaowei-com-cn/git-go v0.0.0-20231001210858-ffa8a39f60e3 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index ec9bff5..43df6b4 100644 --- a/go.sum +++ b/go.sum @@ -27,8 +27,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= -github.com/xanzy/go-gitlab v0.92.3 h1:bMtUHSV5BIhKeka6RyjLOOMZ31byVGDN5pGWmqBsIUs= -github.com/xanzy/go-gitlab v0.92.3/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw= +github.com/xanzy/go-gitlab v0.93.0 h1:/Fy4akqKIQasZgQ2xj2xJBrEZ+iCW+iC+9qLEt19tgo= +github.com/xanzy/go-gitlab v0.93.0/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/xuxiaowei-com-cn/git-go v0.0.0-20231001210858-ffa8a39f60e3 h1:7yU0NZUY14TDTXqifmcHZeYREnwy0yGny1puzh0554Q= diff --git a/job_artifacts/job_artifacts.go b/job_artifacts/job_artifacts.go index 5203f4b..ee6f2ea 100644 --- a/job_artifacts/job_artifacts.go +++ b/job_artifacts/job_artifacts.go @@ -6,8 +6,6 @@ import ( "github.com/xanzy/go-gitlab" "github.com/xuxiaowei-com-cn/gitlab-go/constant" "github.com/xuxiaowei-com-cn/gitlab-go/flag" - "github.com/xuxiaowei-com-cn/gitlab-go/utils" - "net/http" ) // JobsArtifacts 作业产物 API https://docs.gitlab.cn/jh/api/job_artifacts.html @@ -80,20 +78,8 @@ func JobsArtifacts() *cli.Command { return err } - fmt.Printf("Delete ProjectId: %s, Artifacts\n", id) - - project, err := utils.ParseID(id) - if err != nil { - return err - } - u := fmt.Sprintf("projects/%s/artifacts", gitlab.PathEscape(project)) - - req, err := gitClient.NewRequest(http.MethodDelete, u, nil, nil) - if err != nil { - return err - } - - response, err := gitClient.Do(req, nil) + fmt.Printf("Delete ProjectId: %s Artifacts\n", id) + response, err := gitClient.Jobs.DeleteProjectArtifacts(id) fmt.Printf("Response StatusCode: %d\n", response.Response.StatusCode) if err != nil { return err -- GitLab