Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Release Engineering
Public
srpmproc
Commits
e55e442a
Commit
e55e442a
authored
Dec 17, 2020
by
Mustafa Gezen
Browse files
use git committer info from flags
parent
1f074288
Changes
2
Hide whitespace changes
Inline
Side-by-side
cmd/srpmproc/main.go
View file @
e55e442a
...
...
@@ -17,7 +17,8 @@ var (
upstreamPrefix
string
branch
string
gcsBucket
string
debrandedTarballs
[]
string
gitCommitterName
string
gitCommitterEmail
string
)
var
root
=
&
cobra
.
Command
{
...
...
@@ -40,12 +41,14 @@ func mn(_ *cobra.Command, _ []string) {
}
internal
.
ProcessRPM
(
&
internal
.
ProcessData
{
RpmLocation
:
sourceRpmLocation
,
UpstreamPrefix
:
upstreamPrefix
,
SshKeyLocation
:
sshKeyLocation
,
SshUser
:
sshUser
,
Branch
:
branch
,
Bucket
:
client
.
Bucket
(
gcsBucket
),
RpmLocation
:
sourceRpmLocation
,
UpstreamPrefix
:
upstreamPrefix
,
SshKeyLocation
:
sshKeyLocation
,
SshUser
:
sshUser
,
Branch
:
branch
,
Bucket
:
client
.
Bucket
(
gcsBucket
),
GitCommitterName
:
gitCommitterName
,
GitCommitterEmail
:
gitCommitterEmail
,
})
}
...
...
@@ -58,10 +61,11 @@ func main() {
_
=
root
.
MarkFlagRequired
(
"branch"
)
root
.
Flags
()
.
StringVar
(
&
gcsBucket
,
"gcs-bucket"
,
""
,
"Bucket to use as blob storage"
)
_
=
root
.
MarkFlagRequired
(
"gcs-bucket"
)
root
.
Flags
()
.
StringVar
(
&
gitCommitterName
,
"git-committer-name"
,
"distrobuild-bot"
,
"Name of committer"
)
root
.
Flags
()
.
StringVar
(
&
gitCommitterEmail
,
"git-committer-email"
,
"mustafa+distrobuild@bycrates.com"
,
"Email of committer"
)
root
.
Flags
()
.
StringVar
(
&
sshKeyLocation
,
"ssh-key-location"
,
""
,
"Location of the SSH key to use to authenticate against upstream (Optional)"
)
root
.
Flags
()
.
StringVar
(
&
sshUser
,
"ssh-user"
,
"git"
,
"SSH User (Optional, default git)"
)
root
.
Flags
()
.
StringArrayVar
(
&
debrandedTarballs
,
"debranded-tarball"
,
[]
string
{},
"GCS urls to debranded tarballs (stage 2) (Optional)"
)
root
.
Flags
()
.
StringVar
(
&
sshKeyLocation
,
"ssh-key-location"
,
""
,
"Location of the SSH key to use to authenticate against upstream"
)
root
.
Flags
()
.
StringVar
(
&
sshUser
,
"ssh-user"
,
"git"
,
"SSH User"
)
if
err
:=
root
.
Execute
();
err
!=
nil
{
log
.
Fatal
(
err
)
...
...
internal/process.go
View file @
e55e442a
...
...
@@ -29,12 +29,14 @@ import (
)
type
ProcessData
struct
{
RpmLocation
string
UpstreamPrefix
string
SshKeyLocation
string
SshUser
string
Branch
string
Bucket
*
storage
.
BucketHandle
RpmLocation
string
UpstreamPrefix
string
SshKeyLocation
string
SshUser
string
Branch
string
Bucket
*
storage
.
BucketHandle
GitCommitterName
string
GitCommitterEmail
string
}
func
strContains
(
a
[]
string
,
b
string
)
bool
{
...
...
@@ -401,8 +403,8 @@ func ProcessRPM(pd *ProcessData) {
// create import commit
commit
,
err
:=
w
.
Commit
(
"import "
+
filepath
.
Base
(
pd
.
RpmLocation
),
&
git
.
CommitOptions
{
Author
:
&
object
.
Signature
{
Name
:
"Mustafa Gezen"
,
Email
:
"mustafa@bycrates.com"
,
Name
:
pd
.
GitCommitterName
,
Email
:
pd
.
GitCommitterEmail
,
When
:
time
.
Now
(),
},
Parents
:
hashes
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment