Skip to content

Commit

Permalink
chore: sync actor id for github and gitlab. (#2021)
Browse files Browse the repository at this point in the history
## What this PR does / why we need it:

Sync the actor id of CI run.

## Which issue(s) this PR fixes:
none

## Special notes for your reviewer:

## Does this PR introduce a user-facing change?
```
no
```
  • Loading branch information
i4ki authored Dec 20, 2024
2 parents d277299 + 27e3605 commit 6c43bed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cloud/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ type (
GithubCommitCommitterGitDate *time.Time `json:"github_commit_committer_git_date,omitempty"`

GithubActionsDeploymentBranch string `json:"github_actions_deployment_branch,omitempty"`
GithubActionsDeploymentActorID string `json:"github_actions_deployment_actor_id,omitempty"`
GithubActionsDeploymentActor string `json:"github_actions_deployment_actor,omitempty"`
GithubActionsDeploymentTriggeredBy string `json:"github_actions_triggered_by,omitempty"`
GithubActionsRunID string `json:"github_actions_run_id,omitempty"`
Expand Down Expand Up @@ -267,6 +268,7 @@ type (
GitlabCICDJobName string `json:"gitlab_cicd_job_name,omitempty"` // CI_JOB_NAME
GitlabCICDJobStartedAt string `json:"gitlab_cicd_job_started_at,omitempty"` // CI_JOB_STARTED_AT
GitlabCICDUserEmail string `json:"gitlab_cicd_user_email,omitempty"` // GITLAB_USER_EMAIL
GitlabCICDUserID string `json:"gitlab_cicd_user_id,omitempty"` // GITLAB_USER_ID
GitlabCICDUserName string `json:"gitlab_cicd_user_name,omitempty"` // GITLAB_USER_NAME
GitlabCICDUserLogin string `json:"gitlab_cicd_user_login,omitempty"` // GITLAB_USER_LOGIN
GitlabCICDCommitBranch string `json:"gitlab_cicd_commit_branch,omitempty"` // CI_COMMIT_BRANCH
Expand Down
2 changes: 2 additions & 0 deletions cmd/terramate/cli/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ func (c *cli) setGitlabCIMetadata(md *cloud.DeploymentMetadata) {
md.GitlabCICDJobStartedAt = os.Getenv("CI_JOB_STARTED_AT")
md.GitlabCICDUserEmail = os.Getenv("GITLAB_USER_EMAIL")
md.GitlabCICDUserName = os.Getenv("GITLAB_USER_NAME")
md.GitlabCICDUserID = os.Getenv("GITLAB_USER_ID")
md.GitlabCICDUserLogin = os.Getenv("GITLAB_USER_LOGIN")
md.GitlabCICDCommitBranch = os.Getenv("CI_COMMIT_BRANCH")
md.GitlabCICDBranch = md.GitlabCICDCommitBranch
Expand Down Expand Up @@ -1300,6 +1301,7 @@ func setDefaultGitMetadata(md *cloud.DeploymentMetadata, commit *git.CommitMetad
}

func setGithubActionsMetadata(md *cloud.DeploymentMetadata) {
md.GithubActionsDeploymentActorID = os.Getenv("GITHUB_ACTOR_ID")
md.GithubActionsDeploymentActor = os.Getenv("GITHUB_ACTOR")
md.GithubActionsDeploymentTriggeredBy = os.Getenv("GITHUB_TRIGGERING_ACTOR")
md.GithubActionsDeploymentBranch = os.Getenv("GITHUB_REF_NAME")
Expand Down

0 comments on commit 6c43bed

Please sign in to comment.