Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous Delivery - Git PAT support #4276

Merged
merged 2 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "ibm_cd_toolchain_tool_hostedgit" "pipeline_repo" {
name = "pipeline-repo"
initialization {
type = "clone_if_not_exists"
repo_url = var.pipeline_repo
source_repo_url = var.pipeline_repo
private_repo = true
repo_name = join("-", [ var.repositories_prefix, "pipeline-repo" ])
}
Expand All @@ -33,7 +33,7 @@ resource "ibm_cd_toolchain_tool_hostedgit" "tekton_tasks_catalog_repo" {
name = "tasks-repo"
initialization {
type = "clone_if_not_exists"
repo_url = var.tekton_tasks_catalog_repo
source_repo_url = var.tekton_tasks_catalog_repo
private_repo = true
repo_name = join("-", [ var.repositories_prefix, "tasks-repo" ])
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2022 All Rights Reserved.
// Copyright IBM Corp. 2023 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package cdtoolchain
Expand Down Expand Up @@ -129,7 +129,7 @@ func DataSourceIBMCdToolchainToolBitbucketgit() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2022 All Rights Reserved.
// Copyright IBM Corp. 2023 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package cdtoolchain
Expand Down Expand Up @@ -129,7 +129,7 @@ func DataSourceIBMCdToolchainToolGithubconsolidated() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand All @@ -156,6 +156,17 @@ func DataSourceIBMCdToolchainToolGithubconsolidated() *schema.Resource {
Computed: true,
Description: "The ID of the GitHub repository.",
},
"auth_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Select the method of authentication that will be used to access the git provider.",
},
"api_token": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "Personal Access Token.",
},
"toolchain_issues_enabled": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2022 All Rights Reserved.
// Copyright IBM Corp. 2023 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package cdtoolchain
Expand Down Expand Up @@ -129,7 +129,7 @@ func DataSourceIBMCdToolchainToolGitlab() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand All @@ -151,6 +151,17 @@ func DataSourceIBMCdToolchainToolGitlab() *schema.Resource {
Computed: true,
Description: "The ID of the GitLab project.",
},
"auth_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Select the method of authentication that will be used to access the git provider.",
},
"api_token": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "Personal Access Token.",
},
"toolchain_issues_enabled": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2022 All Rights Reserved.
// Copyright IBM Corp. 2023 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package cdtoolchain
Expand Down Expand Up @@ -129,7 +129,7 @@ func DataSourceIBMCdToolchainToolHostedgit() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand All @@ -151,6 +151,17 @@ func DataSourceIBMCdToolchainToolHostedgit() *schema.Resource {
Computed: true,
Description: "The ID of the Git Repos and Issue Tracking project.",
},
"auth_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Select the method of authentication that will be used to access the git provider.",
},
"api_token": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Sensitive: true,
Description: "Personal Access Token.",
},
"toolchain_issues_enabled": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2022 All Rights Reserved.
// Copyright IBM Corp. 2023 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package cdtoolchain
Expand Down Expand Up @@ -84,7 +84,7 @@ func ResourceIBMCdToolchainToolBitbucketgit() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand Down Expand Up @@ -158,7 +158,7 @@ func ResourceIBMCdToolchainToolBitbucketgit() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2022 All Rights Reserved.
// Copyright IBM Corp. 2023 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package cdtoolchain
Expand Down Expand Up @@ -84,7 +84,7 @@ func ResourceIBMCdToolchainToolGithubconsolidated() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand Down Expand Up @@ -113,6 +113,18 @@ func ResourceIBMCdToolchainToolGithubconsolidated() *schema.Resource {
Computed: true,
Description: "The ID of the GitHub repository.",
},
"auth_type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "Select the method of authentication that will be used to access the git provider.",
},
"api_token": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: flex.SuppressHashedRawSecret,
Sensitive: true,
Description: "Personal Access Token.",
},
"toolchain_issues_enabled": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -163,7 +175,7 @@ func ResourceIBMCdToolchainToolGithubconsolidated() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand Down
18 changes: 15 additions & 3 deletions ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_gitlab.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2022 All Rights Reserved.
// Copyright IBM Corp. 2023 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package cdtoolchain
Expand Down Expand Up @@ -84,7 +84,7 @@ func ResourceIBMCdToolchainToolGitlab() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand All @@ -108,6 +108,18 @@ func ResourceIBMCdToolchainToolGitlab() *schema.Resource {
Computed: true,
Description: "The ID of the GitLab project.",
},
"auth_type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "Select the method of authentication that will be used to access the git provider.",
},
"api_token": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: flex.SuppressHashedRawSecret,
Sensitive: true,
Description: "Personal Access Token.",
},
"toolchain_issues_enabled": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -158,7 +170,7 @@ func ResourceIBMCdToolchainToolGitlab() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' to create a new git repository, 'clone' to clone an existing repository into a new git repository, 'fork' to fork an existing git repository, or 'link' to link to an existing git repository.",
Description: "The operation that should be performed to initialize the new tool integration. Use 'new' or 'new_if_not_exists' to create a new git repository, 'clone' or 'clone_if_not_exists' to clone an existing repository into a new git repository, 'fork' or 'fork_if_not_exists' to fork an existing git repository, or 'link' to link to an existing git repository. If you attempt to apply a resource with type 'new', 'clone', or 'fork' when the target repo already exists, the attempt will fail. If you apply a resource with type 'new_if_not_exists`, 'clone_if_not_exists', or 'fork_if_not_exists' when the target repo already exists, the existing repo will be used as-is.",
},
"private_repo": &schema.Schema{
Type: schema.TypeBool,
Expand Down
Loading