diff --git a/notify_teams_gitlab_project_visibility/README.md b/notify_teams_gitlab_project_visibility/README.md index 70c5d95..bef1b53 100644 --- a/notify_teams_gitlab_project_visibility/README.md +++ b/notify_teams_gitlab_project_visibility/README.md @@ -4,8 +4,8 @@ Notify a Teams channel with GitLab Public Projects of a group. Optionally, updat ## Usage -- Add your Slack API token and channel name to `flowpipe.pvars` -- Add your GitLab API token to `flowpipe.pvars` +- Add your Microsoft Teams channel ID to `flowpipe.pvars` +- Add your GitLab and Microsoft Teams API tokens to `credential` resource in any `.fpc` file in the config directory (~/.flowpipe/config/*.fpc). - Start your Flowpipe server - Run the pipeline and specify `group_id` e.g., `flowpipe pipeline run notify_teams_gitlab_project_visibility --arg group_id=77637670 --arg teams_channel_id="19:P7fSYEJGuWSTHTfYAMAZEzIc1Uk8BTS-abcdnSV2H-A1@thread.tacv2"` diff --git a/notify_teams_gitlab_project_visibility/mod.fp b/notify_teams_gitlab_project_visibility/mod.fp index 88e0da6..8c865e9 100644 --- a/notify_teams_gitlab_project_visibility/mod.fp +++ b/notify_teams_gitlab_project_visibility/mod.fp @@ -4,16 +4,12 @@ mod "notify_teams_gitlab_project_visibility" { require { mod "github.com/turbot/flowpipe-mod-gitlab" { - version = "v0.0.1-rc-3" - args = { - access_token = var.gitlab_access_token - } + version = "v0.0.1-rc.4" } mod "github.com/turbot/flowpipe-mod-teams" { - version = "v0.0.1-rc.4" + version = "v0.0.1-rc.13" args = { - access_token = var.teams_access_token - team_id = var.team_id + team_id = var.team_id } } } diff --git a/notify_teams_gitlab_project_visibility/notify_teams_gitlab_project_visibility.fp b/notify_teams_gitlab_project_visibility/notify_teams_gitlab_project_visibility.fp index f4f297c..c1a83bc 100644 --- a/notify_teams_gitlab_project_visibility/notify_teams_gitlab_project_visibility.fp +++ b/notify_teams_gitlab_project_visibility/notify_teams_gitlab_project_visibility.fp @@ -2,15 +2,15 @@ pipeline "notify_teams_gitlab_project_visibility" { title = "Notify GitLab Project Visibility Changes" description = "Notify a Slack channel when a GitLab's project visibility is changed." - param "gitlab_access_token" { + param "gitlab_credentials" { type = string - description = "GitLab personal, project, or group access token to authenticate to the API. Example: glpat-ABC123_456-789." - default = var.gitlab_access_token + description = "Name for GitLab credentials to use. If not provided, the default credentials will be used." + default = "default" } param "group_id" { type = string - description = "GitLab Group ID" + description = "GitLab Group ID." } param "action_public_to_private" { @@ -19,10 +19,10 @@ pipeline "notify_teams_gitlab_project_visibility" { default = false } - param "teams_access_token" { + param "teams_credentials" { type = string - description = "The MS Team access token to use for the API request." - default = var.teams_access_token + description = "Name for Microsoft Teams credentials to use. If not provided, the default credentials will be used." + default = "default" } param "team_id" { @@ -40,9 +40,9 @@ pipeline "notify_teams_gitlab_project_visibility" { pipeline = gitlab.pipeline.list_group_projects args = { - access_token = param.gitlab_access_token - group_id = param.group_id - visibility = "public" + cred = param.gitlab_credentials + group_id = param.group_id + visibility = "public" } } @@ -55,16 +55,16 @@ pipeline "notify_teams_gitlab_project_visibility" { pipeline = gitlab.pipeline.update_project args = { - access_token = param.gitlab_access_token - visibility = "private" - project_id = tostring(each.value.id) + cred = param.gitlab_credentials + visibility = "private" + project_id = tostring(each.value.id) } } step "pipeline" "send_message" { pipeline = teams.pipeline.send_channel_message args = { - access_token = param.teams_access_token + cred = param.teams_credentials team_id = param.team_id channel_id = param.teams_channel_id message_content_type = "html" diff --git a/notify_teams_gitlab_project_visibility/variables.fp b/notify_teams_gitlab_project_visibility/variables.fp index b7489ad..65e31b8 100644 --- a/notify_teams_gitlab_project_visibility/variables.fp +++ b/notify_teams_gitlab_project_visibility/variables.fp @@ -1,13 +1,3 @@ -variable "gitlab_access_token" { - type = string - description = "GitLab personal, project, or group access token to authenticate to the API. Example: glpat-ABC123_456-789." -} - -variable "teams_access_token" { - description = "The Microsoft personal security access_token to authenticate to the Microsoft graph APIs." - type = string -} - variable "team_id" { description = "The unique identifier of the Team." type = string