From 652ce0d87559159fd2c17e2099193e109436739bc77b228d403fd7e5f74363bf Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Tue, 10 Sep 2024 18:24:41 +0200 Subject: [PATCH] copyright --- bots-common/config.go | 24 +++++++-- bots-common/consts.go | 18 +++++++ bots-common/conststring_test.go | 24 +++++++-- bots-common/git_utils.go | 18 +++++++ bots-common/git_utils_test.go | 18 +++++++ bots-common/gitea_utils.go | 18 +++++++ bots-common/listen.go | 20 +++++++- bots-common/log.go | 19 ++++++- bots-common/log_test.go | 18 +++++++ bots-common/obs_utils.go | 18 +++++++ bots-common/obs_utils_test.go | 18 +++++++ bots-common/request_create.go | 19 ++++++- bots-common/request_fork.go | 19 ++++++- bots-common/request_handler.go | 30 ++++++++--- bots-common/request_issue.go | 19 ++++++- bots-common/request_pr.go | 22 +++++++- bots-common/request_pr_test.go | 20 +++++++- bots-common/request_push.go | 20 +++++++- bots-common/request_push_test.go | 18 +++++++ bots-common/request_release.go | 18 +++++++ bots-common/request_repo.go | 20 +++++++- bots-common/request_repo_test.go | 19 ++++++- bots-common/request_wiki.go | 21 +++++++- bots-common/tokens.go | 18 +++++++ devel-importer/main.go | 18 +++++++ gitea-events-rabbitmq-publisher/main.go | 18 +++++++ gitea-events-rabbitmq-publisher/rabbitmq.go | 20 +++++++- obs-staging-bot/main.go | 18 +++++++ obs-staging-bot/rabbitmq.go | 20 +++++++- obs-status-service/main.go | 56 ++++++++++++++------- obs-status-service/rabbitmq.go | 24 +++++++-- pr-review/main.go | 44 +++++++++++----- prjgit-updater/main.go | 18 +++++++ 33 files changed, 649 insertions(+), 63 deletions(-) diff --git a/bots-common/config.go b/bots-common/config.go index 994bc11..6c55945 100644 --- a/bots-common/config.go +++ b/bots-common/config.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "encoding/json" "fmt" @@ -10,10 +28,10 @@ import ( ) type AutogitConfig struct { - Workflows []string // [pr, direct, test] + Workflows []string // [pr, direct, test] Organization string - GitProjectName string // Organization/GitProjectName.git is PrjGit - Branch string // branch name of PkgGit that aligns with PrjGit submodules + GitProjectName string // Organization/GitProjectName.git is PrjGit + Branch string // branch name of PkgGit that aligns with PrjGit submodules } func ReadWorkflowConfigs(reader io.Reader) ([]*AutogitConfig, error) { diff --git a/bots-common/consts.go b/bots-common/consts.go index 836ca5a..002e23d 100644 --- a/bots-common/consts.go +++ b/bots-common/consts.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + const ( GiteaTokenEnv = "GITEA_TOKEN" ObsUserEnv = "OBS_USER" diff --git a/bots-common/conststring_test.go b/bots-common/conststring_test.go index 8a55458..bf616a5 100644 --- a/bots-common/conststring_test.go +++ b/bots-common/conststring_test.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + const examplePushJSON = `{ "ref": "refs/heads/main", "before": "9fe6b18fee74f49786c39e062ef02bcfb560a0be6eb7851b81954123e2d55629", @@ -431,7 +449,6 @@ const repoCreateJSON = `{ } }` - const createBranchJSON = `{ "sha": "691c91e5240f24f5a75393caf8a78826b8a6f9f272ab4faef024102739f0060a", "ref": "main", @@ -636,7 +653,7 @@ const createBranchJSON = `{ } }` -const createTagJSON=`{ +const createTagJSON = `{ "sha": "691c91e5240f24f5a75393caf8a78826b8a6f9f272ab4faef024102739f0060a", "ref": "foobar", "ref_type": "tag", @@ -840,7 +857,6 @@ const createTagJSON=`{ } }` - const createIssueJSON = `{ "action": "opened", "number": 1, @@ -1020,7 +1036,6 @@ const createIssueJSON = `{ "commit_id": "" }` - const issueAssignJSON = `{ "action": "unassigned", "number": 1, @@ -1716,4 +1731,3 @@ const requestedReviewJSON = `{ "commit_id": "", "review": null }` - diff --git a/bots-common/git_utils.go b/bots-common/git_utils.go index af39c32..4144711 100644 --- a/bots-common/git_utils.go +++ b/bots-common/git_utils.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "fmt" "io" diff --git a/bots-common/git_utils_test.go b/bots-common/git_utils_test.go index 1bfb798..af0f6ab 100644 --- a/bots-common/git_utils_test.go +++ b/bots-common/git_utils_test.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "os" "os/exec" diff --git a/bots-common/gitea_utils.go b/bots-common/gitea_utils.go index aca4026..a30eb32 100644 --- a/bots-common/gitea_utils.go +++ b/bots-common/gitea_utils.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "fmt" "io" diff --git a/bots-common/listen.go b/bots-common/listen.go index 25cde5e..ec4aae0 100644 --- a/bots-common/listen.go +++ b/bots-common/listen.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "crypto/tls" "fmt" @@ -163,7 +181,7 @@ func ProcessEvent(f RequestProcessor, h *RequestHandler) { if err := f(h); err != nil { log.Println(err) } - + } func ProcessRabbitMQEvents(listenDefs ListenDefinitions, orgs []string) error { diff --git a/bots-common/log.go b/bots-common/log.go index 3699a22..8ba4af1 100644 --- a/bots-common/log.go +++ b/bots-common/log.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "fmt" "io" @@ -15,4 +33,3 @@ func CreateStdoutLogger(stdout, stderr io.Writer) (*log.Logger, *log.Logger) { errLogger := log.New(stderr, idStr, log.Lmsgprefix) return stdLogger, errLogger } - diff --git a/bots-common/log_test.go b/bots-common/log_test.go index f1b1acb..f8dc019 100644 --- a/bots-common/log_test.go +++ b/bots-common/log_test.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "bytes" "regexp" diff --git a/bots-common/obs_utils.go b/bots-common/obs_utils.go index ca0fca6..2c3ed45 100644 --- a/bots-common/obs_utils.go +++ b/bots-common/obs_utils.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "bytes" "encoding/xml" diff --git a/bots-common/obs_utils_test.go b/bots-common/obs_utils_test.go index 30ae16b..2428bd9 100644 --- a/bots-common/obs_utils_test.go +++ b/bots-common/obs_utils_test.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "testing" ) diff --git a/bots-common/request_create.go b/bots-common/request_create.go index 001aa96..2556af1 100644 --- a/bots-common/request_create.go +++ b/bots-common/request_create.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + type CreateWebhookEvent struct { Sha string Ref string // name of tag/branch @@ -12,4 +30,3 @@ type CreateWebhookEvent struct { func (c *CreateWebhookEvent) GetAction() string { return c.Ref_type } - diff --git a/bots-common/request_fork.go b/bots-common/request_fork.go index 2005048..1367f75 100644 --- a/bots-common/request_fork.go +++ b/bots-common/request_fork.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + type ForkWebhookEvent struct { Forkee *Repository Repository *Repository @@ -9,4 +27,3 @@ type ForkWebhookEvent struct { func (*ForkWebhookEvent) GetAction() string { return "fork" } - diff --git a/bots-common/request_handler.go b/bots-common/request_handler.go index 34afdc8..44f35e6 100644 --- a/bots-common/request_handler.go +++ b/bots-common/request_handler.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "encoding/json" "fmt" @@ -74,7 +92,7 @@ type RequestHandler struct { StdLogger, ErrLogger *log.Logger Request *Request -// Git *GitHandler + // Git *GitHandler } func (r *RequestHandler) WriteError() { @@ -86,11 +104,11 @@ func CreateRequestHandler() (*RequestHandler, error) { h.StdLogger, h.ErrLogger = CreateStdoutLogger(os.Stdout, os.Stderr) -/* var err error - h.Git, err = CreateGitHandler(git_author, name) - if err != nil { - return nil, err - } + /* var err error + h.Git, err = CreateGitHandler(git_author, name) + if err != nil { + return nil, err + } */ return h, nil } diff --git a/bots-common/request_issue.go b/bots-common/request_issue.go index 851b366..e5f1971 100644 --- a/bots-common/request_issue.go +++ b/bots-common/request_issue.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + type IssueDetail struct { Id int Number int @@ -48,4 +66,3 @@ func (i *IssueWebhookEvent) GetAction() string { func (i *IssueCommentWebhookEvent) GetAction() string { return i.Action } - diff --git a/bots-common/request_pr.go b/bots-common/request_pr.go index 6355119..55b3a6e 100644 --- a/bots-common/request_pr.go +++ b/bots-common/request_pr.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "encoding/json" "fmt" @@ -51,14 +69,14 @@ func (p *PullRequestWebhookEvent) GetAction() string { } func (h *RequestHandler) parsePullRequest(data io.Reader) (action *PullRequestWebhookEvent, err error) { - action=new(PullRequestWebhookEvent) + action = new(PullRequestWebhookEvent) err = json.NewDecoder(data).Decode(&action) if err != nil { return nil, fmt.Errorf("Got error while parsing json: %w", err) } - h.Request = &Request { + h.Request = &Request{ Data: action, Type: RequestType_PR, } diff --git a/bots-common/request_pr_test.go b/bots-common/request_pr_test.go index da696f0..c89a960 100644 --- a/bots-common/request_pr_test.go +++ b/bots-common/request_pr_test.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "os" "strings" @@ -661,7 +679,7 @@ const samplePR_JSON = `{ } ` -const samplePRsync_JSON=`{ +const samplePRsync_JSON = `{ "action": "synchronized", "number": 1, "pull_request": { diff --git a/bots-common/request_push.go b/bots-common/request_push.go index d9cb71c..8a80063 100644 --- a/bots-common/request_push.go +++ b/bots-common/request_push.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "encoding/json" "fmt" @@ -40,7 +58,7 @@ func (h *RequestHandler) parsePushRequest(data io.Reader) (*PushWebhookEvent, er } h.StdLogger.Printf("Request push for repo: %s\n", action.Repository.Full_Name) - h.Request = &Request { + h.Request = &Request{ Type: RequestType_Push, Data: action, } diff --git a/bots-common/request_push_test.go b/bots-common/request_push_test.go index ea83689..3c18299 100644 --- a/bots-common/request_push_test.go +++ b/bots-common/request_push_test.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "os" "strings" diff --git a/bots-common/request_release.go b/bots-common/request_release.go index ba6629f..107ece1 100644 --- a/bots-common/request_release.go +++ b/bots-common/request_release.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + type ReleaseWebhookDetail struct { Tag_name string Name string diff --git a/bots-common/request_repo.go b/bots-common/request_repo.go index 9c44e40..107b100 100644 --- a/bots-common/request_repo.go +++ b/bots-common/request_repo.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "encoding/json" "fmt" @@ -64,7 +82,7 @@ func (h *RequestHandler) parseRepositoryRequest(dataReader io.Reader) (data *Rep return nil, fmt.Errorf("Request has no data.... skipping") } - h.Request = &Request { + h.Request = &Request{ Data: data, Type: RequestType_Repository, } diff --git a/bots-common/request_repo_test.go b/bots-common/request_repo_test.go index 94d28d7..2cf2071 100644 --- a/bots-common/request_repo_test.go +++ b/bots-common/request_repo_test.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "os" "strings" @@ -15,7 +33,6 @@ func (s *testLogger) WriteString(str2 string) (int, error) { return len(s.str), nil } - func TestRepositoryRequestParsing(t *testing.T) { t.Run("parsing repo creation message", func(t *testing.T) { var h RequestHandler diff --git a/bots-common/request_wiki.go b/bots-common/request_wiki.go index 95e7977..2c7a8af 100644 --- a/bots-common/request_wiki.go +++ b/bots-common/request_wiki.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + type WikiWebhookEvent struct { Action string Page string @@ -9,7 +27,6 @@ type WikiWebhookEvent struct { Sender User } -func (w *WikiWebhookEvent) GetAction() string { +func (w *WikiWebhookEvent) GetAction() string { return w.Action } - diff --git a/bots-common/tokens.go b/bots-common/tokens.go index 74bffa5..2df535f 100644 --- a/bots-common/tokens.go +++ b/bots-common/tokens.go @@ -1,5 +1,23 @@ package common +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "errors" "fmt" diff --git a/devel-importer/main.go b/devel-importer/main.go index 73aa5a3..e6df87b 100644 --- a/devel-importer/main.go +++ b/devel-importer/main.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "errors" "flag" diff --git a/gitea-events-rabbitmq-publisher/main.go b/gitea-events-rabbitmq-publisher/main.go index c296eca..bf337a6 100644 --- a/gitea-events-rabbitmq-publisher/main.go +++ b/gitea-events-rabbitmq-publisher/main.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "encoding/json" "flag" diff --git a/gitea-events-rabbitmq-publisher/rabbitmq.go b/gitea-events-rabbitmq-publisher/rabbitmq.go index ac3c769..4a6c8d9 100644 --- a/gitea-events-rabbitmq-publisher/rabbitmq.go +++ b/gitea-events-rabbitmq-publisher/rabbitmq.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "context" "crypto/tls" @@ -43,7 +61,7 @@ func PublishMessage(giteaOrg, giteaWebhookType, action string, data []byte) erro } } else { msg = Message{ - Topic: fmt.Sprintf("%s.%s.%s.%s", topicScope, common.TopicApp, giteaOrg, giteaWebhookType), + Topic: fmt.Sprintf("%s.%s.%s.%s", topicScope, common.TopicApp, giteaOrg, giteaWebhookType), Body: data, } } diff --git a/obs-staging-bot/main.go b/obs-staging-bot/main.go index c0e3471..25229db 100644 --- a/obs-staging-bot/main.go +++ b/obs-staging-bot/main.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "bytes" "errors" diff --git a/obs-staging-bot/rabbitmq.go b/obs-staging-bot/rabbitmq.go index 2f035f1..f2a180e 100644 --- a/obs-staging-bot/rabbitmq.go +++ b/obs-staging-bot/rabbitmq.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "crypto/tls" "encoding/json" @@ -97,7 +115,7 @@ func ProcessingObsMessages(host, username, password, queueName string) { if obsNotifications == nil { obsNotifications = make(map[string]*BuildNotification) -// notificationChannels = make(map[string]chan *BuildNotification) + // notificationChannels = make(map[string]chan *BuildNotification) } auth := "" diff --git a/obs-status-service/main.go b/obs-status-service/main.go index 4634cc0..2e41426 100644 --- a/obs-status-service/main.go +++ b/obs-status-service/main.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "fmt" "log" @@ -22,28 +40,30 @@ type BuildStatusCacheItem struct { var obs *common.ObsClient var buildStatusCache map[string]BuildStatusCacheItem -/* -func CacheBuildStatus(prj, pkg string) ([]common.BuildResult, error) { - list, err := obs.BuildStatus(prj, pkg) - if err != nil { - return nil, err - } - return -} +/* + func CacheBuildStatus(prj, pkg string) ([]common.BuildResult, error) { + list, err := obs.BuildStatus(prj, pkg) + if err != nil { + return nil, err + } + + return + } */ func PackageBuildStatus(prj, pkg string) (common.ObsBuildStatusDetail, error) { - return common.ObsBuildStatusDetail { - Code: "succeeded", + return common.ObsBuildStatusDetail{ + Code: "succeeded", Description: "stuff", - Success: true, - Finished: true, + Success: true, + Finished: true, }, nil } + /* -func PackageStatusSvg(buildStatus []common.ObsBuildStatusDetail) []byte { - return -} + func PackageStatusSvg(buildStatus []common.ObsBuildStatusDetail) []byte { + return + } */ func PackageStatusSummarySvg(buildStatus common.ObsBuildStatusDetail) []byte { fillColor := "orange" @@ -74,9 +94,9 @@ func main() { log.Fatal("OBS_HOSTNAME env required.") } /* - if obs, err := common.NewObsClient(obsHost); err != nil { - log.Fatal(err) - } + if obs, err := common.NewObsClient(obsHost); err != nil { + log.Fatal(err) + } */ http.HandleFunc("GET /{ObsProject}", func(res http.ResponseWriter, req *http.Request) { diff --git a/obs-status-service/rabbitmq.go b/obs-status-service/rabbitmq.go index ee62ce1..ad53615 100644 --- a/obs-status-service/rabbitmq.go +++ b/obs-status-service/rabbitmq.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "crypto/tls" "encoding/json" @@ -120,15 +138,15 @@ func ProcessingObsMessages(host, username, password, queueName string) { }() var err error - out, err = os.OpenFile("messages.txt", os.O_WRONLY | os.O_APPEND, 0644) + out, err = os.OpenFile("messages.txt", os.O_WRONLY|os.O_APPEND, 0644) if err != nil { log.Printf("Cannot open message.txt: %v", err) - return + return } if obsNotifications == nil { obsNotifications = make(map[string]*BuildNotification) -// notificationChannels = make(map[string]chan *BuildNotification) + // notificationChannels = make(map[string]chan *BuildNotification) } auth := "" diff --git a/pr-review/main.go b/pr-review/main.go index 946e4e0..c67c5c1 100644 --- a/pr-review/main.go +++ b/pr-review/main.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "fmt" "os" @@ -34,21 +52,21 @@ func fetchPrGit(h *common.RequestHandler, pr *models.PullRequest) error { func processPullRequestClosed(h *common.RequestHandler) error { // this needs to be moved to pull merger return nil -/* - req := h.Data.(*common.PullRequestAction) - if req.Repository.Name != common.DefaultGitPrj { - // we only handle project git PR updates here - return nil - } + /* + req := h.Data.(*common.PullRequestAction) - + if req.Repository.Name != common.DefaultGitPrj { + // we only handle project git PR updates here + return nil + } - if err := fetchPrGit(h, req.Pull_Request); err != nil { - return err - } - headSubmodules := h.GitSubmoduleList(dir, pr.Head.Sha) - baseSubmodules := h.GitSubmoduleList(dir, pr.Base.Sha) - return nil + if err := fetchPrGit(h, req.Pull_Request); err != nil { + return err + } + + headSubmodules := h.GitSubmoduleList(dir, pr.Head.Sha) + baseSubmodules := h.GitSubmoduleList(dir, pr.Base.Sha) + return nil */ } diff --git a/prjgit-updater/main.go b/prjgit-updater/main.go index 59db74a..9909c2e 100644 --- a/prjgit-updater/main.go +++ b/prjgit-updater/main.go @@ -1,5 +1,23 @@ package main +/* + * This file is part of Autogits. + * + * Copyright © 2024 SUSE LLC + * + * Autogits is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * Autogits is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Foobar. If not, see . + */ + import ( "flag" "fmt"