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

feat(tmc): add support for bitbucket pipelines. #2010

Merged
merged 1 commit into from
Dec 19, 2024
Merged

feat(tmc): add support for bitbucket pipelines. #2010

merged 1 commit into from
Dec 19, 2024

Conversation

i4ki
Copy link
Contributor

@i4ki i4ki commented Dec 17, 2024

What this PR does / why we need it:

Add support for Bitbucket Cloud in the Terramate Cloud sync features.

Which issue(s) this PR fixes:

none

Special notes for your reviewer:

Does this PR introduce a user-facing change?

yes, adds a Terramate Cloud feature.

@i4ki i4ki force-pushed the i4k-bb-tmc branch 2 times, most recently from 6d90efb to f97fc7a Compare December 17, 2024 19:44
Copy link

github-actions bot commented Dec 17, 2024

2024/12/19 14:31:38 Terraform detected version: 1.10.2
toolsetPath: /tmp/cmd-terramate-test-3562594752
=== RUN   TestInteropCloudSyncPreview
=== RUN   TestInteropCloudSyncPreview/preview:_basic-drift
    interoperability_test.go:46: using GITHUB_EVENT_FILE=/home/runner/work/_temp/_github_workflow/event.json
=== RUN   TestInteropCloudSyncPreview/preview:_basic-drift-uppercase-id
    interoperability_test.go:46: using GITHUB_EVENT_FILE=/home/runner/work/_temp/_github_workflow/event.json
--- PASS: TestInteropCloudSyncPreview (14.59s)
    --- PASS: TestInteropCloudSyncPreview/preview:_basic-drift (7.45s)
    --- PASS: TestInteropCloudSyncPreview/preview:_basic-drift-uppercase-id (7.14s)
=== RUN   TestInteropSyncDeployment
=== RUN   TestInteropSyncDeployment/deployment:_empty
=== RUN   TestInteropSyncDeployment/deployment:_empty-uppercase-id
--- PASS: TestInteropSyncDeployment (45.46s)
    --- PASS: TestInteropSyncDeployment/deployment:_empty (23.27s)
    --- PASS: TestInteropSyncDeployment/deployment:_empty-uppercase-id (22.19s)
=== RUN   TestInteropDrift
=== RUN   TestInteropDrift/drift:_basic-drift
=== RUN   TestInteropDrift/drift:_basic-drift-uppercase-id
--- PASS: TestInteropDrift (73.16s)
    --- PASS: TestInteropDrift/drift:_basic-drift (36.66s)
    --- PASS: TestInteropDrift/drift:_basic-drift-uppercase-id (36.50s)
PASS
ok  	github.com/terramate-io/terramate/e2etests/cloud/interop	189.996s

Copy link

github-actions bot commented Dec 17, 2024

metric: time/op
ChangeDetection-4: old 3.96ms ± 4%: new 3.95ms ± 4%: delta: 0.00%
ChangeDetectionTFAndTG-4: old 12.7ms ± 3%: new 12.7ms ± 3%: delta: 0.00%
CloudReadLines-4: old 983µs ± 5%: new 972µs ± 4%: delta: 0.00%
CloudReadLine-4: old 7.23ms ± 1%: new 7.21ms ± 2%: delta: 0.00%
ListFiles-4: old 86.2µs ± 1%: new 86.5µs ± 1%: delta: 0.30%
Generate-4: old 1.54s ± 4%: new 1.54s ± 2%: delta: 0.00%
GenerateRegex-4: old 1.06s ± 4%: new 1.06s ± 3%: delta: 0.00%
TokensForExpressionComplex-4: old 1.25ms ± 0%: new 1.25ms ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 785ns ± 1%: new 786ns ± 1%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 23.5µs ± 1%: new 23.5µs ± 1%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 1.44ms ± 0%: new 1.44ms ± 0%: delta: 0.00%
TokensForExpression-4: old 1.25ms ± 0%: new 1.25ms ± 0%: delta: -0.10%
PartialEvalComplex-4: old 536µs ± 1%: new 537µs ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 3.87µs ± 1%: new 3.87µs ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 1.94ms ± 1%: new 1.92ms ± 1%: delta: -1.14%
PartialEvalHugeInterpolatedString-4: old 4.91ms ± 2%: new 4.91ms ± 2%: delta: 0.00%
PartialEvalObject-4: old 26.4µs ± 1%: new 26.4µs ± 1%: delta: 0.00%
TmAllTrueLiteralList-4: old 617µs ± 1%: new 616µs ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 20.2µs ± 1%: new 20.1µs ± 0%: delta: -0.27%
TmAnyTrueLiteralList-4: old 4.86ms ± 1%: new 4.86ms ± 1%: delta: 0.00%
TmAnyTrueFuncall-4: old 20.6µs ± 1%: new 20.5µs ± 0%: delta: -0.66%
TmTernary-4: old 2.51µs ± 1%: new 2.48µs ± 1%: delta: -1.30%
TmTryUnknownFunc-4: old 2.27µs ± 0%: new 2.26µs ± 0%: delta: -0.59%
TmTryUnknownVariable-4: old 2.18µs ± 0%: new 2.16µs ± 0%: delta: -0.63%
TmTryUnknownObjectKey-4: old 2.49µs ± 1%: new 2.47µs ± 0%: delta: -0.70%
metric: alloc/op
ChangeDetection-4: old 357kB ± 0%: new 357kB ± 0%: delta: 0.00%
ChangeDetectionTFAndTG-4: old 4.81MB ± 0%: new 4.81MB ± 0%: delta: -0.05%
CloudReadLines-4: old 3.12MB ± 0%: new 3.12MB ± 0%: delta: 0.00%
CloudReadLine-4: old 3.37MB ± 0%: new 3.37MB ± 0%: delta: 0.00%
ListFiles-4: old 27.6kB ± 0%: new 27.6kB ± 0%: delta: 0.00%
Generate-4: old 2.24GB ± 0%: new 2.24GB ± 0%: delta: 0.00%
GenerateRegex-4: old 926MB ± 0%: new 926MB ± 0%: delta: 0.00%
TokensForExpressionComplex-4: old 394kB ± 0%: new 394kB ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 512B ± 0%: new 512B ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 12.5kB ± 0%: new 12.5kB ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 395kB ± 0%: new 395kB ± 0%: delta: 0.00%
TokensForExpression-4: old 394kB ± 0%: new 394kB ± 0%: delta: 0.00%
PartialEvalComplex-4: old 361kB ± 0%: new 361kB ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 1.95kB ± 0%: new 1.95kB ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 196kB ± 0%: new 196kB ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 4.31MB ± 0%: new 4.31MB ± 0%: delta: 0.00%
PartialEvalObject-4: old 19.4kB ± 0%: new 19.4kB ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 321kB ± 0%: new 321kB ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 10.6kB ± 0%: new 10.6kB ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 2.09MB ± 0%: new 2.09MB ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 10.7kB ± 0%: new 10.7kB ± 0%: delta: 0.00%
TmTernary-4: old 1.18kB ± 0%: new 1.18kB ± 0%: delta: 0.00%
TmTryUnknownFunc-4: old 784B ± 0%: new 784B ± 0%: delta: 0.00%
TmTryUnknownVariable-4: old 768B ± 0%: new 768B ± 0%: delta: 0.00%
TmTryUnknownObjectKey-4: old 952B ± 0%: new 952B ± 0%: delta: 0.00%
metric: allocs/op
ChangeDetection-4: old 2.48k ± 0%: new 2.48k ± 0%: delta: 0.00%
ChangeDetectionTFAndTG-4: old 33.8k ± 0%: new 33.7k ± 0%: delta: -0.10%
CloudReadLines-4: old 5.54k ± 0%: new 5.54k ± 0%: delta: 0.00%
CloudReadLine-4: old 60.0k ± 0%: new 60.0k ± 0%: delta: 0.00%
ListFiles-4: old 335 ± 0%: new 335 ± 0%: delta: 0.00%
Generate-4: old 25.7M ± 0%: new 25.7M ± 0%: delta: 0.00%
GenerateRegex-4: old 18.4M ± 0%: new 18.4M ± 0%: delta: 0.00%
TokensForExpressionComplex-4: old 4.83k ± 0%: new 4.83k ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 20.0 ± 0%: new 20.0 ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 227 ± 0%: new 227 ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 3.19k ± 0%: new 3.19k ± 0%: delta: 0.00%
TokensForExpression-4: old 4.83k ± 0%: new 4.83k ± 0%: delta: 0.00%
PartialEvalComplex-4: old 3.78k ± 0%: new 3.78k ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 26.0 ± 0%: new 26.0 ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 38.0 ± 0%: new 38.0 ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 26.1k ± 0%: new 26.1k ± 0%: delta: 0.00%
PartialEvalObject-4: old 183 ± 0%: new 183 ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 5.94k ± 0%: new 5.94k ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 275 ± 0%: new 275 ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 59.6k ± 0%: new 59.6k ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 277 ± 0%: new 277 ± 0%: delta: 0.00%
TmTernary-4: old 27.0 ± 0%: new 27.0 ± 0%: delta: 0.00%
TmTryUnknownFunc-4: old 21.0 ± 0%: new 21.0 ± 0%: delta: 0.00%
TmTryUnknownVariable-4: old 20.0 ± 0%: new 20.0 ± 0%: delta: 0.00%
TmTryUnknownObjectKey-4: old 23.0 ± 0%: new 23.0 ± 0%: delta: 0.00%

@i4ki i4ki force-pushed the i4k-bb-tmc branch 2 times, most recently from ab11abf to bd60af2 Compare December 17, 2024 20:43
Copy link
Contributor

@sixstone-qq sixstone-qq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review :)

cloud/types.go Show resolved Hide resolved
cloud/types.go Outdated Show resolved Hide resolved
cmd/terramate/cli/cloud.go Show resolved Hide resolved
cmd/terramate/cli/cloud.go Show resolved Hide resolved
@i4ki i4ki force-pushed the i4k-bb-tmc branch 11 times, most recently from 9ae86ef to 0e94caa Compare December 18, 2024 20:36
Copy link

github-actions bot commented Dec 18, 2024

Preview of ubuntu-focal/go1.21 tests in 38c3830

🔍 View Details on Terramate Cloud

.
ci
cloud
cmd/terramate/cli
cmd/terramate/cli/bitbucket
cmd/terramate/cli/gitlab
generate
e2etests/cloud

Copy link

github-actions bot commented Dec 18, 2024

Preview of macos-ventura/go1.21 tests in 38c3830

🔍 View Details on Terramate Cloud

.
ci
cloud
cmd/terramate/cli
cmd/terramate/cli/bitbucket
cmd/terramate/cli/gitlab
generate
e2etests/cloud

@i4ki i4ki marked this pull request as ready for review December 18, 2024 22:34
@i4ki i4ki requested review from a team as code owners December 18, 2024 22:34
Copy link
Contributor

@sixstone-qq sixstone-qq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions :)

cmd/terramate/cli/cloud.go Show resolved Hide resolved
Branch: c.cloud.run.metadata.BitbucketPipelinesBranch,
BaseBranch: c.cloud.run.metadata.BitbucketPipelinesDestinationBranch,
ChangesRequestedCount: changesRequestedCount,
ApprovedCount: approvedCount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing reviewers here? You can get them from participants quite easily, no?

e2etests/cloud/run_script_cloud_drift_test.go Show resolved Hide resolved
md.BitbucketPipelinesDeploymentEnvironmentUUID = os.Getenv("BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID")
md.BitbucketPipelinesProjectKey = os.Getenv("BITBUCKET_PROJECT_KEY")
md.BitbucketPipelinesProjectUUID = os.Getenv("BITBUCKET_PROJECT_UUID")
md.BitbucketPipelinesStepTriggererUUID = os.Getenv("BITBUCKET_STEP_TRIGGERER_UUID")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the triggerer of a deployment? We can get as well the pipeline creator calling GetPipeline, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually the triggerer of the step. You can re-run a step in Bitbucket, if it fails. But usually yes, the step triggerer is the same as the pipeline creator but not always.

If you say fetching the pipeline creator is required to have some functionality, then yes I can fetch it.

Number: pr.ID,
Title: pr.Title,
Description: pr.Summary.Raw,
CommitSHA: c.prj.headCommit(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not correct for deployments where it should be the head commit from the branch, not the head of base branch, no?

@i4ki i4ki force-pushed the i4k-bb-tmc branch 2 times, most recently from 2f15278 to 00e5545 Compare December 19, 2024 10:20
@i4ki i4ki force-pushed the i4k-bb-tmc branch 2 times, most recently from ad22d1d to a81e2b6 Compare December 19, 2024 14:27
@i4ki i4ki merged commit a866da0 into main Dec 19, 2024
7 checks passed
@i4ki i4ki deleted the i4k-bb-tmc branch December 19, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants