[arvados-dev] created: 87dcb0fae25b06b9ded592b55084fb5a4cdba8fc

git repository hosting git at public.arvados.org
Wed Jan 25 18:55:33 UTC 2023


        at  87dcb0fae25b06b9ded592b55084fb5a4cdba8fc (commit)


commit 87dcb0fae25b06b9ded592b55084fb5a4cdba8fc
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Jan 25 15:55:08 2023 -0300

    Ignore .gitignore files for licensing. No issue #
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/.licenseignore b/.licenseignore
index f5ac2b6..d74efb6 100644
--- a/.licenseignore
+++ b/.licenseignore
@@ -1,18 +1,17 @@
 # Copyright (C) The Arvados Authors. All rights reserved.
 #
 # SPDX-License-Identifier: Apache-2.0
-jenkins/test-arvados-multinode/.gitignore
+.gitignore
+*/.gitignore
 jenkins/test-arvados-multinode/terraform/outputs.tf
 jenkins/test-arvados-multinode/terraform/variables.tf
 jenkins/test-arvados-multinode/terraform/terraform.tfvars
 jenkins/test-arvados-multinode/terraform/provider.tf
 jenkins/test-arvados-multinode/terraform/main.tf
 jenkins/test-arvados-multinode/certs/*
-jenkins/packer-images/.gitignore
 jenkins/packer-images/*.json
 jenkins/packer-images/1078ECD7.asc
 go.mod
 go.sum
 cmd/art/TASKS
-cmd/review-task-reminder/.gitignore
 cmd/review-task-reminder/emailTemplate.txt

commit c231a405c9c9795d63f9d18451beb5e31e19a17e
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Jan 25 15:38:35 2023 -0300

    Adds 'associate-orphans' subcommand. Refs #19920
    
    This subcommand takes a project name, a release ID and searches for
    every open issue that's not assigned to a version and release,
    associating it with the given release ID.
    There's a dry-run parameter to allow the user to double check before
    committing.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/cmd/art/.gitignore b/cmd/art/.gitignore
new file mode 100644
index 0000000..5f7602f
--- /dev/null
+++ b/cmd/art/.gitignore
@@ -0,0 +1 @@
+art
diff --git a/cmd/art/redmine.go b/cmd/art/redmine.go
index 16bc865..abeded3 100644
--- a/cmd/art/redmine.go
+++ b/cmd/art/redmine.go
@@ -43,6 +43,19 @@ func init() {
 	}
 	issuesCmd.AddCommand(associateIssueCmd)
 
+	associateOrphans.Flags().IntP("release", "r", 0, "Redmine release ID")
+	err = associateOrphans.MarkFlagRequired("release")
+	if err != nil {
+		log.Fatalf(err.Error())
+	}
+	associateOrphans.Flags().StringP("project", "p", "", "Redmine project name")
+	err = associateOrphans.MarkFlagRequired("project")
+	if err != nil {
+		log.Fatalf(err.Error())
+	}
+	associateOrphans.Flags().BoolP("dry-run", "", false, "Only report what will happen without making any change")
+	issuesCmd.AddCommand(associateOrphans)
+
 	findAndAssociateIssuesCmd.Flags().IntP("release", "r", 0, "Redmine release ID")
 	err = findAndAssociateIssuesCmd.MarkFlagRequired("release")
 	if err != nil {
@@ -123,6 +136,68 @@ var issuesCmd = &cobra.Command{
 		"\nThe REDMINE_APIKEY environment variable must be set to your redmine API key.",
 }
 
+var associateOrphans = &cobra.Command{
+	Use:   "associate-orphans", // FIXME
+	Short: "Find open issues without a release and version, assign them to the given release",
+	Long: "Find open issues without a release and version, assign them to the given release.\n" +
+		"\nThe REDMINE_ENDPOINT environment variable must be set to the base URL of your redmine server." +
+		"\nThe REDMINE_APIKEY environment variable must be set to your redmine API key.",
+	Run: func(cmd *cobra.Command, args []string) {
+		rID, err := cmd.Flags().GetInt("release")
+		if err != nil {
+			fmt.Printf("Error converting Redmine release ID to integer: %s", err)
+			os.Exit(1)
+		}
+		pName, err := cmd.Flags().GetString("project")
+		if err != nil {
+			log.Fatalf("Error getting the requested project name: %s", err)
+		}
+		dryRun, err := cmd.Flags().GetBool("dry-run")
+		if err != nil {
+			log.Fatalf("Error getting the dry-run parameter")
+		}
+
+		rm := redmine.NewClient(conf.Endpoint, conf.Apikey)
+		p, err := rm.GetProjectByName(pName)
+		if err != nil {
+			log.Fatalf("Error retrieving project ID for '%s': %s", pName, err)
+		}
+		r, err := rm.GetRelease(rID)
+		if err != nil {
+			log.Fatalf("Error retrieving release '%d': %s", rID, err)
+		}
+		flt := redmine.IssueFilter{
+			StatusID:  "open",
+			ProjectID: fmt.Sprintf("%d", p.ID),
+			// No values assigned on the following fields. It seems that using
+			// an empty string is interpreted as 'any value'. The documentation
+			// isn't clear, but after some trial & error, '!*' seems to do the trick.
+			// https://www.redmine.org/projects/redmine/wiki/Rest_Issues
+			ReleaseID: "!*",
+			VersionID: "!*",
+			ParentID:  "!*",
+		}
+		issues, err := rm.FilteredIssues(&flt)
+		if err != nil {
+			fmt.Printf("Error requesting unassigned open issues from project %d: %s", p.ID, err)
+		}
+		fmt.Printf("Found %d issues from project '%s' to assign to release '%s'...\n", len(issues), p.Name, r.Name)
+		for _, issue := range issues {
+			fmt.Printf("#%d - %s ", issue.ID, issue.Subject)
+			if !dryRun {
+				err = rm.SetRelease(issue, rID)
+				if err != nil {
+					fmt.Printf("[error]\n")
+					log.Fatalf("Error trying to assign issue %d to release %d: %s", issue.ID, rID, err)
+				}
+				fmt.Printf("[changed]\n")
+			} else {
+				fmt.Printf("[skipped]\n")
+			}
+		}
+	},
+}
+
 var associateIssueCmd = &cobra.Command{
 	Use:   "associate",
 	Short: "Associate an issue with a release",
@@ -239,7 +314,7 @@ var findAndAssociateIssuesCmd = &cobra.Command{
 		//arvRepo := "https://git.arvados.org/arvados.git"
 		//arvRepo := "https://github.com/arvados/arvados.git"
 
-		fmt.Println("Cloning "+arvRepo)
+		fmt.Println("Cloning " + arvRepo)
 		repo, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
 			URL: arvRepo,
 		})

commit 910855ed735ae713198cd43df7855653c0dc4d64
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Jan 25 11:44:03 2023 -0300

    Adds release filtering on issues. Refs #19920
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/lib/redmine/issues.go b/lib/redmine/issues.go
index fc76540..ea2f584 100644
--- a/lib/redmine/issues.go
+++ b/lib/redmine/issues.go
@@ -52,6 +52,7 @@ type IssueFilter struct {
 	Subject   string
 	ParentID  string
 	VersionID string
+	ReleaseID string
 }
 
 type issuesResult struct {
@@ -88,6 +89,9 @@ func issueFilters(issueFilter *IssueFilter) []string {
 	if len(issueFilter.VersionID) > 0 {
 		filterParameters = append(filterParameters, fmt.Sprintf("fixed_version_id=%v", issueFilter.VersionID))
 	}
+	if len(issueFilter.ReleaseID) > 0 {
+		filterParameters = append(filterParameters, fmt.Sprintf("release_id=%v", issueFilter.ReleaseID))
+	}
 
 	return filterParameters
 }

commit bd69d138932fa9a1cb4df0eb162ae254e24a8ab3
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Jan 19 11:32:18 2023 -0300

    Adds gitignore. Refs #19920
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..696153c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.infracost/
\ No newline at end of file

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list