From 315e9c5b5b3ee4b19463f440571711666c19e6b0 Mon Sep 17 00:00:00 2001 From: Matt Schuchard Date: Wed, 17 Apr 2024 09:53:46 -0400 Subject: [PATCH] misc updates and first doc update --- .circleci/config.yml | 2 +- README.md | 14 ++++++++++++++ src/github_issue.rs | 2 +- src/main.rs | 6 ++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 32aef00..264b69e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: test: working_directory: /tmp/project docker: - - image: cimg/rust:1.75.0 + - image: cimg/rust:1.77 resource_class: small steps: - checkout diff --git a/README.md b/README.md index b919305..2ee5973 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,20 @@ This repository and project is based on the work performed for [MITODL](https:// - `repo`: _required_ The Github repository with the issue tracker in which to read and/or create issues. +- `skip_check`: _optional_ + - `number`: _optional_ The issue number to read during the `check` step for triggering Concourse pipelines based on the issue state. If this is omitted then the `check` step is skipped. +The following parameters are for filtering from a list of issues to one issue, and therefore are ignored when an input value is specified for the `number` parameter. + +- `state`: _optional_ + - `milestone`: _optional_ currently not interfaced between frontend and backend +- `assignee`: _optional_ + +- `labels`: _optional_ + ### `version`: designates the Github issue state **parameters** @@ -51,6 +61,8 @@ This ignores any inputs and quickly dummies outputs, and therefore is primarily The `out` step creates a Github issue according to the input parameters below. The number of the created Github issue is written to a file at `/opt/resource/issue_number.txt` so that it can be re-used later in the build (especially for a subsequent `check` step to trigger based on the status of the Github issue created during this step). +The metadata output from this step contains the number, labels, assignees, and milestone for the issue. + - `title`: _required_ The title of the Github issue. - `body`: _optional_ The body of the Github issue. @@ -61,6 +73,8 @@ The `out` step creates a Github issue according to the input parameters below. T - `milestone`: _optional_ The milestone number to associate with the issue during creation. +- `state`: _optional_ + ## Example ```yaml diff --git a/src/github_issue.rs b/src/github_issue.rs index 2eee580..0a93a8a 100644 --- a/src/github_issue.rs +++ b/src/github_issue.rs @@ -13,7 +13,7 @@ pub(crate) enum Action { Update, } -// convert string to IssueState or params::State without trait implementations because not allowed +// convert string to IssueState or params::State without trait implementations because not allowed (no impl Into for &str) fn str_to_issue_state(param: &str) -> Result { match param { "Open" => Ok(octocrab::models::IssueState::Open), diff --git a/src/main.rs b/src/main.rs index d5974c7..8389ea5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use concourse_resource::*; -use log; use env_logger; +use log; mod concourse; mod github_issue; @@ -34,7 +34,9 @@ impl concourse_resource::Resource for GithubIssue { // return immediately with two sized vector if check step skip requested (e.g. source for out/put+create) if source.skip_check() { - log::info!("the check step will be skipped because 'skip_check' was set to true in source"); + log::info!( + "the check step will be skipped because 'skip_check' was set to true in source" + ); return vec![ concourse::Version::new(String::from("Open")), concourse::Version::new(String::from("Closed")),