Skip to content

Conversation

@dlpzx
Copy link
Contributor

@dlpzx dlpzx commented Sep 3, 2025

Issue #, if available:
The CloudFormation resources for GitLab projects have some limitations and require hardcoded names for the namespaces/users.

Description of changes:
Refactored the lambda_function that creates the team repositories: moved creation logic outside of the lambda_handler file. Created a function for each git provider. In the GitLab provider, added API-first approach.

⚠️ This is the first of a series of pull requests

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dlpzx dlpzx force-pushed the feat/API-integration-3p-git branch 4 times, most recently from 21a8543 to d2eb1ad Compare September 3, 2025 12:29
@dlpzx dlpzx force-pushed the feat/API-integration-3p-git branch from d2eb1ad to 1ea4c74 Compare September 3, 2025 12:32
@dlpzx dlpzx marked this pull request as ready for review September 3, 2025 12:34

- `/SDLF/GitLab/Url` :: secure-string :: GitLab URL **with** trailing `/`
- `/SDLF/GitLab/AccessToken` :: secure-string :: User access token
- `/SDLF/GitLab/NamespaceId` :: string :: User/Enterprise namespace ID

Choose a reason for hiding this comment

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

This should be secure-string

- `/SDLF/GitLab/Url` :: secure-string :: GitLab URL **with** trailing `/`
- `/SDLF/GitLab/AccessToken` :: secure-string :: User access token
- `/SDLF/GitLab/NamespaceId` :: string :: User/Enterprise namespace ID
- `/SDLF/GitLab/CodeConnection` :: string :: CodeConnections ARN

Choose a reason for hiding this comment

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

Can this now be removed?

Copy link
Contributor Author

@dlpzx dlpzx Sep 5, 2025

Choose a reason for hiding this comment

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

You still need to connection to the codepipeline. I did not remove it to ensure the pipeline can read the gitlab repo as source (search for "{{resolve:ssm:/SDLF/${pGitPlatform}/CodeConnection}}" in the code)

@dlpzx dlpzx force-pushed the feat/API-integration-3p-git branch from 7dfe0b5 to e092b9c Compare September 5, 2025 09:02
@dlpzx dlpzx requested a review from jamieibbs September 8, 2025 08:15
- !Sub "{{resolve:ssm:/SDLF/KMS/${pTeamName}/InfraKeyId:1}}"
- !Sub "{{resolve:ssm:/SDLF/KMS/${pTeamName}/DataKeyId:1}}"
- !Sub "{{resolve:ssm:/SDLF2/KMS/KeyArn:1}}"
- "{{resolve:ssm:/SDLF2/KMS/KeyArn:1}}"

Choose a reason for hiding this comment

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

is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is nothing to replace using Sub, it should just resolve the SSM name. In the other 2 SSM params we are replacing pTeamName using Sub

ssm = boto3.client("ssm", endpoint_url=ssm_endpoint_url)
codecommit_endpoint_url = "https://codecommit." + os.getenv("AWS_REGION") + ".amazonaws.com"
codecommit = boto3.client("codecommit", endpoint_url=codecommit_endpoint_url)
cloudformation_endpoint_url = "https://cloudformation." + os.getenv("AWS_REGION") + ".amazonaws.com"

Choose a reason for hiding this comment

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

nit - is this needed? wouldn't the default endpoint be the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the same way of defining endpoints are before, you can check sdlf-cicd/lambda/domain-cicd/src/lambda_function.py

@dlpzx dlpzx merged commit 8e0fa94 into main Sep 8, 2025
5 of 6 checks passed
@dlpzx dlpzx deleted the feat/API-integration-3p-git branch October 1, 2025 07:06
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