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

GL-1723: Added expires_at mandatory arg for codestudio token. #1617

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions src/Command/CodeStudio/CodeStudioWizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@
$this->checklist->completePreviousItem();
}
$this->checklist->addItem("Creating access token named <comment>$projectAccessTokenName</comment>");
$dateTime = new \DateTime('tomorrow');
Copy link
Contributor

Choose a reason for hiding this comment

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

This token needs to be long-lived since it's going to be stored as a CI/CD variable, right? Should we max out the lifetime (1 year)?

$projectAccessToken = $this->gitLabClient->projects()
->createProjectAccessToken($project['id'], [

Check warning on line 166 in src/Command/CodeStudio/CodeStudioWizardCommand.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } $this->checklist->addItem("Creating access token named <comment>{$projectAccessTokenName}</comment>"); $dateTime = new \DateTime('tomorrow'); - $projectAccessToken = $this->gitLabClient->projects()->createProjectAccessToken($project['id'], ['expires_at' => $dateTime, 'name' => $projectAccessTokenName, 'scopes' => ['api', 'write_repository']]); + $projectAccessToken = $this->gitLabClient->projects()->createProjectAccessToken($project['id'], ['name' => $projectAccessTokenName, 'scopes' => ['api', 'write_repository']]); $this->checklist->completePreviousItem(); return $projectAccessToken['token']; }
'expires_at' => $dateTime,
'name' => $projectAccessTokenName,
'scopes' => ['api', 'write_repository'],
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,13 @@ public function testMissingGitLabCredentials(): void {
}

protected function mockGitLabProjectsTokens(ObjectProphecy $projects): void {
$dateTime = new \DateTime('tomorrow');
$tokens = [
0 => [
'access_level' => 40,
'active' => TRUE,
'created_at' => '2021-12-28T20:08:21.629Z',
'expires_at' => NULL,
'expires_at' => $dateTime,
'id' => $this->gitLabTokenId,
'name' => 'acquia-codestudio',
'revoked' => FALSE,
Expand Down
Loading