Commit e55e442a authored by Mustafa Gezen's avatar Mustafa Gezen
Browse files

use git committer info from flags

parent 1f074288
......@@ -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)
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment