Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nmaas Janitor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nmaas
nmaas Janitor
Commits
1761f8f5
Commit
1761f8f5
authored
6 years ago
by
Michał Bień
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bug when storing empty configmap
parent
98f59004
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
pkg/cmd/server/build.sh
+1
-0
1 addition, 0 deletions
pkg/cmd/server/build.sh
pkg/service/v1/config-service.go
+7
-8
7 additions, 8 deletions
pkg/service/v1/config-service.go
with
8 additions
and
8 deletions
pkg/cmd/server/build.sh
0 → 100755
+
1
−
0
View file @
1761f8f5
GOOS
=
linux
GOARCH
=
amd64 go build
This diff is collapsed.
Click to expand it.
pkg/service/v1/config-service.go
+
7
−
8
View file @
1761f8f5
...
@@ -78,7 +78,7 @@ func (s *configServiceServer) FindGitlabProjectId(api *gitlab.Client, uid string
...
@@ -78,7 +78,7 @@ func (s *configServiceServer) FindGitlabProjectId(api *gitlab.Client, uid string
func
(
s
*
configServiceServer
)
PrepareDataJsonFromRepository
(
api
*
gitlab
.
Client
,
repoId
int
)
([]
byte
,
error
)
{
func
(
s
*
configServiceServer
)
PrepareDataJsonFromRepository
(
api
*
gitlab
.
Client
,
repoId
int
)
([]
byte
,
error
)
{
//List files
//List files
tree
,
_
,
err
:=
s
.
gitAPI
.
Repositories
.
ListTree
(
repoId
,
nil
)
tree
,
_
,
err
:=
s
.
gitAPI
.
Repositories
.
ListTree
(
repoId
,
nil
)
if
err
!=
nil
||
len
(
tree
)
==
0
{
if
err
!=
nil
{
log
.
Print
(
err
)
log
.
Print
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"Cannot find any config files"
)
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"Cannot find any config files"
)
}
}
...
@@ -108,12 +108,11 @@ func (s *configServiceServer) PrepareDataJsonFromRepository(api *gitlab.Client,
...
@@ -108,12 +108,11 @@ func (s *configServiceServer) PrepareDataJsonFromRepository(api *gitlab.Client,
compiledMap
=
append
(
compiledMap
,
mapAfterName
...
)
compiledMap
=
append
(
compiledMap
,
mapAfterName
...
)
compiledMap
=
append
(
compiledMap
,
base64
.
StdEncoding
.
EncodeToString
(
data
)
...
)
compiledMap
=
append
(
compiledMap
,
base64
.
StdEncoding
.
EncodeToString
(
data
)
...
)
if
numFiles
-
1
==
i
{
//it's last element
if
numFiles
-
1
!=
i
{
//it's not last element
compiledMap
=
append
(
compiledMap
,
mapAfterLast
...
)
}
else
{
compiledMap
=
append
(
compiledMap
,
mapNextData
...
)
compiledMap
=
append
(
compiledMap
,
mapNextData
...
)
}
}
}
}
compiledMap
=
append
(
compiledMap
,
mapAfterLast
...
)
return
compiledMap
,
nil
return
compiledMap
,
nil
}
}
...
@@ -129,10 +128,10 @@ func (s *configServiceServer) PrepareDataMapFromRepository(api *gitlab.Client, r
...
@@ -129,10 +128,10 @@ func (s *configServiceServer) PrepareDataMapFromRepository(api *gitlab.Client, r
log
.
Print
(
err
)
log
.
Print
(
err
)
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"Cannot find any config files"
)
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"Cannot find any config files"
)
}
}
if
len
(
tree
)
==
0
{
//
if len(tree) == 0 {
log
.
Printf
(
"There are no files to config in repo %d"
,
repoId
)
//
log.Printf("There are no files to config in repo %d", repoId)
return
compiledMap
,
nil
//
return compiledMap, nil
}
//
}
//Start parsing
//Start parsing
for
_
,
file
:=
range
tree
{
for
_
,
file
:=
range
tree
{
...
...
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