Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Seipel
gitlab-runner
Commits
628f6e61
Commit
628f6e61
authored
9 years ago
by
Kamil Trzcinski
Browse files
Options
Downloads
Patches
Plain Diff
Support a new Credentials API
parent
f85855b9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/build.go
+25
-0
25 additions, 0 deletions
common/build.go
common/network.go
+18
-17
18 additions, 17 deletions
common/network.go
with
43 additions
and
17 deletions
common/build.go
+
25
−
0
View file @
628f6e61
...
@@ -9,7 +9,9 @@ import (
...
@@ -9,7 +9,9 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"encoding/base64"
"github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus"
"github.com/dustin/gojson"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers"
"time"
"time"
)
)
...
@@ -271,6 +273,28 @@ func (b *Build) String() string {
...
@@ -271,6 +273,28 @@ func (b *Build) String() string {
return
helpers
.
ToYAML
(
b
)
return
helpers
.
ToYAML
(
b
)
}
}
func
(
b
*
Build
)
GetDockerConfig
()
string
{
config
:=
&
struct
{
Authorizations
map
[
string
]
interface
{}
`json:"auths"`
}{
Authorizations
:
make
(
map
[
string
]
interface
{}),
}
for
_
,
credential
:=
range
b
.
Credentials
.
GetByType
(
CredentialContainerRegistry
)
{
config
.
Authorizations
[
credential
.
ServerURL
]
=
&
struct
{
Auth
string
`json:"auth"`
}{
Auth
:
credential
.
EncodeUserAndPassword
(),
}
}
data
,
err
:=
json
.
Marshal
(
config
)
if
err
!=
nil
{
return
""
}
return
string
(
data
)
}
func
(
b
*
Build
)
GetDefaultVariables
()
BuildVariables
{
func
(
b
*
Build
)
GetDefaultVariables
()
BuildVariables
{
return
BuildVariables
{
return
BuildVariables
{
{
"CI"
,
"true"
,
true
,
true
,
false
},
{
"CI"
,
"true"
,
true
,
true
,
false
},
...
@@ -286,6 +310,7 @@ func (b *Build) GetDefaultVariables() BuildVariables {
...
@@ -286,6 +310,7 @@ func (b *Build) GetDefaultVariables() BuildVariables {
{
"CI_SERVER_NAME"
,
"GitLab CI"
,
true
,
true
,
false
},
{
"CI_SERVER_NAME"
,
"GitLab CI"
,
true
,
true
,
false
},
{
"CI_SERVER_VERSION"
,
""
,
true
,
true
,
false
},
{
"CI_SERVER_VERSION"
,
""
,
true
,
true
,
false
},
{
"CI_SERVER_REVISION"
,
""
,
true
,
true
,
false
},
{
"CI_SERVER_REVISION"
,
""
,
true
,
true
,
false
},
{
"DOCKER_CONFIG"
,
b
.
GetDockerConfig
(),
false
,
true
,
true
},
{
"GITLAB_CI"
,
"true"
,
true
,
true
,
false
},
{
"GITLAB_CI"
,
"true"
,
true
,
true
,
false
},
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
common/network.go
+
18
−
17
View file @
628f6e61
...
@@ -70,23 +70,24 @@ type BuildInfo struct {
...
@@ -70,23 +70,24 @@ type BuildInfo struct {
}
}
type
GetBuildResponse
struct
{
type
GetBuildResponse
struct
{
ID
int
`json:"id,omitempty"`
ID
int
`json:"id,omitempty"`
ProjectID
int
`json:"project_id,omitempty"`
ProjectID
int
`json:"project_id,omitempty"`
Commands
string
`json:"commands,omitempty"`
Commands
string
`json:"commands,omitempty"`
RepoURL
string
`json:"repo_url,omitempty"`
RepoURL
string
`json:"repo_url,omitempty"`
Sha
string
`json:"sha,omitempty"`
Sha
string
`json:"sha,omitempty"`
RefName
string
`json:"ref,omitempty"`
RefName
string
`json:"ref,omitempty"`
BeforeSha
string
`json:"before_sha,omitempty"`
BeforeSha
string
`json:"before_sha,omitempty"`
AllowGitFetch
bool
`json:"allow_git_fetch,omitempty"`
AllowGitFetch
bool
`json:"allow_git_fetch,omitempty"`
Timeout
int
`json:"timeout,omitempty"`
Timeout
int
`json:"timeout,omitempty"`
Variables
BuildVariables
`json:"variables"`
Variables
BuildVariables
`json:"variables"`
Options
BuildOptions
`json:"options"`
Options
BuildOptions
`json:"options"`
Token
string
`json:"token"`
Token
string
`json:"token"`
Name
string
`json:"name"`
Name
string
`json:"name"`
Stage
string
`json:"stage"`
Stage
string
`json:"stage"`
Tag
bool
`json:"tag"`
Tag
bool
`json:"tag"`
DependsOnBuilds
[]
BuildInfo
`json:"depends_on_builds"`
DependsOnBuilds
[]
BuildInfo
`json:"depends_on_builds"`
TLSCAChain
string
`json:"-"`
Credentials
BuildCredentials
`json:"credentials"`
TLSCAChain
string
`json:"-"`
}
}
type
RegisterRunnerRequest
struct
{
type
RegisterRunnerRequest
struct
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment