Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
policy
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gaia-X
Trust Services API
policy
Commits
a60dcd25
Commit
a60dcd25
authored
2 years ago
by
Yordan Kinkov
Browse files
Options
Downloads
Patches
Plain Diff
#32
add proper filename during sync
parent
f80a6be7
No related branches found
No related tags found
1 merge request
!33
Add proper filename during sync
Pipeline
#52770
passed with stages
in 1 minute and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/sync/main.go
+7
-5
7 additions, 5 deletions
cmd/sync/main.go
with
7 additions
and
5 deletions
cmd/sync/main.go
+
7
−
5
View file @
a60dcd25
...
...
@@ -161,10 +161,9 @@ func createPolicy(p string, d os.DirEntry) (*Policy, error) {
return
nil
,
fmt
.
Errorf
(
"failed to get policy filename, name, version and group out of policy path: %s"
,
p
)
}
filename
:=
ss
[
len
(
ss
)
-
1
]
// last element in the array is filename
version
:=
ss
[
len
(
ss
)
-
2
]
// second last element is the version
name
:=
ss
[
len
(
ss
)
-
3
]
// third last element is the policy name
group
:=
ss
[
len
(
ss
)
-
4
]
// fourth last element is the policy group
version
:=
ss
[
len
(
ss
)
-
2
]
// second last element is the version
name
:=
ss
[
len
(
ss
)
-
3
]
// third last element is the policy name
group
:=
ss
[
len
(
ss
)
-
4
]
// fourth last element is the policy group
bytes
,
err
:=
os
.
ReadFile
(
p
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -178,8 +177,11 @@ func createPolicy(p string, d os.DirEntry) (*Policy, error) {
}
data
:=
string
(
dataBytes
)
// generate filename for DB from pattern {group}/{name}/{version}/policy.rego
dbFilename
:=
group
+
"/"
+
name
+
"/"
+
version
+
"/"
+
policyFilename
return
&
Policy
{
Filename
:
f
ilename
,
Filename
:
dbF
ilename
,
Name
:
name
,
Group
:
group
,
Version
:
version
,
...
...
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