mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
Fix gitlab (#1639)
* always use git token if we provide one Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com> * bump go-git-url for gitlab fix Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com> * fix action permissions for cosign signature Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com> --------- Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
name: d-publish-image
|
||||
permissions: read-all
|
||||
permissions:
|
||||
contents: read
|
||||
metadata: read
|
||||
id-token: write
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
|
||||
@@ -65,24 +65,23 @@ func cloneRepo(gitURL giturl.IGitAPI) (string, error) {
|
||||
// Get the URL to clone
|
||||
cloneURL := gitURL.GetHttpCloneURL()
|
||||
|
||||
isGitRepoPublic := isGitRepoPublic(cloneURL)
|
||||
isGitTokenPresent := isGitTokenPresent(gitURL)
|
||||
|
||||
// Declare the authentication variable required for cloneOptions
|
||||
var auth transport.AuthMethod
|
||||
|
||||
if isGitRepoPublic {
|
||||
// No authentication needed if repository is public
|
||||
auth = nil
|
||||
} else {
|
||||
|
||||
// Return Error if the AUTH_TOKEN is not present
|
||||
if isGitTokenPresent := isGitTokenPresent(gitURL); !isGitTokenPresent {
|
||||
return "", getProviderError(gitURL)
|
||||
}
|
||||
if isGitTokenPresent {
|
||||
auth = &http.BasicAuth{
|
||||
Username: "x-token-auth",
|
||||
Password: gitURL.GetToken(),
|
||||
}
|
||||
} else {
|
||||
// If the repository is public, no authentication is needed
|
||||
if isGitRepoPublic(cloneURL) {
|
||||
auth = nil
|
||||
} else {
|
||||
return "", getProviderError(gitURL)
|
||||
}
|
||||
}
|
||||
|
||||
// For Azure repo cloning
|
||||
|
||||
@@ -26,7 +26,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/jwalton/gchalk v1.3.0
|
||||
github.com/kubescape/backend v0.0.19
|
||||
github.com/kubescape/go-git-url v0.0.29
|
||||
github.com/kubescape/go-git-url v0.0.30
|
||||
github.com/kubescape/go-logger v0.0.22
|
||||
github.com/kubescape/k8s-interface v0.0.161
|
||||
github.com/kubescape/opa-utils v0.0.278
|
||||
|
||||
@@ -1142,8 +1142,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kubescape/backend v0.0.19 h1:u8gp/VljTEFrdjtHo+IB9KeBhf+8n1St+J2kOFvPj+I=
|
||||
github.com/kubescape/backend v0.0.19/go.mod h1:FpazfN+c3Ucuvv4jZYCnk99moSBRNMVIxl5aWCZAEBo=
|
||||
github.com/kubescape/go-git-url v0.0.29 h1:/crwNMDTB9PZBbZicgYUn183FIAexFT86XDXY2YtYZ0=
|
||||
github.com/kubescape/go-git-url v0.0.29/go.mod h1:3ddc1HEflms1vMhD9owt/3FBES070UaYTUarcjx8jDk=
|
||||
github.com/kubescape/go-git-url v0.0.30 h1:PIbg86ae0ftee/p/Tu/6CA1ju6VoJ51G3sQWNHOm6wg=
|
||||
github.com/kubescape/go-git-url v0.0.30/go.mod h1:3ddc1HEflms1vMhD9owt/3FBES070UaYTUarcjx8jDk=
|
||||
github.com/kubescape/go-logger v0.0.22 h1:gle7wH6emOiGv9ljdpVi82pWLQ3jGucrUucvil6JXHE=
|
||||
github.com/kubescape/go-logger v0.0.22/go.mod h1:x3HBpZo3cMT/WIdy18BxvVVd5D0e/PWFVk/HiwBNu3g=
|
||||
github.com/kubescape/k8s-interface v0.0.161 h1:v6b3/kmA4o/2niNrejrbXj5X9MLfH0UrpI3s+e/fdwc=
|
||||
|
||||
+1
-1
@@ -289,7 +289,7 @@ require (
|
||||
github.com/knqyf263/go-deb-version v0.0.0-20230223133812-3ed183d23422 // indirect
|
||||
github.com/knqyf263/go-rpm-version v0.0.0-20220614171824-631e686d1075 // indirect
|
||||
github.com/knqyf263/go-rpmdb v0.0.0-20230517124904-b97c85e63254 // indirect
|
||||
github.com/kubescape/go-git-url v0.0.29 // indirect
|
||||
github.com/kubescape/go-git-url v0.0.30 // indirect
|
||||
github.com/kubescape/rbac-utils v0.0.21-0.20230806101615-07e36f555520 // indirect
|
||||
github.com/kubescape/regolibrary v1.0.315 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
|
||||
+2
-2
@@ -1148,8 +1148,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kubescape/backend v0.0.19 h1:u8gp/VljTEFrdjtHo+IB9KeBhf+8n1St+J2kOFvPj+I=
|
||||
github.com/kubescape/backend v0.0.19/go.mod h1:FpazfN+c3Ucuvv4jZYCnk99moSBRNMVIxl5aWCZAEBo=
|
||||
github.com/kubescape/go-git-url v0.0.29 h1:/crwNMDTB9PZBbZicgYUn183FIAexFT86XDXY2YtYZ0=
|
||||
github.com/kubescape/go-git-url v0.0.29/go.mod h1:3ddc1HEflms1vMhD9owt/3FBES070UaYTUarcjx8jDk=
|
||||
github.com/kubescape/go-git-url v0.0.30 h1:PIbg86ae0ftee/p/Tu/6CA1ju6VoJ51G3sQWNHOm6wg=
|
||||
github.com/kubescape/go-git-url v0.0.30/go.mod h1:3ddc1HEflms1vMhD9owt/3FBES070UaYTUarcjx8jDk=
|
||||
github.com/kubescape/go-logger v0.0.22 h1:gle7wH6emOiGv9ljdpVi82pWLQ3jGucrUucvil6JXHE=
|
||||
github.com/kubescape/go-logger v0.0.22/go.mod h1:x3HBpZo3cMT/WIdy18BxvVVd5D0e/PWFVk/HiwBNu3g=
|
||||
github.com/kubescape/k8s-interface v0.0.161 h1:v6b3/kmA4o/2niNrejrbXj5X9MLfH0UrpI3s+e/fdwc=
|
||||
|
||||
Reference in New Issue
Block a user