-
Notifications
You must be signed in to change notification settings - Fork 8
chore(apps/gcp/jenkins): add tidbx docker config secret for jenkins credentials #1808
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
Conversation
credentials Add secret for TiDB-X OCI artifact authentication to beta pre environment via ExternalSecret resource
|
/approve |
Summary of ChangesHello @wuhuizuo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Jenkins environment on GCP by adding a new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wuhuizuo The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have already done a preliminary review for you, and I hope to help you do a better job.
Summary
This PR introduces a new ExternalSecret resource named tidbx-docker-config in the Jenkins beta pre environment to manage TiDB-X OCI artifact authentication credentials. It adds the secret manifest and references it in the relevant kustomization.yaml. The approach follows existing patterns and is straightforward. Overall, the changes appear correct and consistent with the existing setup, but there are a few minor improvements and clarifications needed.
Code Improvements
-
Typo in annotation value
- File:
apps/gcp/jenkins/beta/pre/secret-tidbx-docker-config.yaml(line 15) - Issue: The annotation value has a typo:
"docker auth credintial for TiDB-X OCI artifacts"(credintial→credential). - Suggestion: Correct the spelling to improve clarity and professionalism:
jenkins.io/credentials-description: docker auth credential for TiDB-X OCI artifacts
- File:
-
Potential mismatch in filename convention
- File:
apps/gcp/jenkins/beta/pre/secret-tidbx-docker-config.yaml(line 18) - Issue: The filename is set as
docker.config, a less common name compared to the standardconfig.jsonfor Docker credentials files. This might cause confusion or integration issues if Jenkins expects the standard name. - Suggestion: Verify that the Jenkins credential provider expects
docker.config. If not, rename it toconfig.jsonfor compatibility, e.g.:filename: config.json
- File:
-
Clarify the secretKey and remoteRef usage
- File:
apps/gcp/jenkins/beta/pre/secret-tidbx-docker-config.yaml(lines 23-26) - Issue: The key
gcp_tidbx_dockerconfig_jsonis referenced without context here; ensure this matches the key in the secret manager exactly. - Suggestion: Confirm that the secret key
gcp_tidbx_dockerconfig_jsonexists with proper data, and consider adding a comment to clarify this linkage for future maintainers.
- File:
Best Practices
-
Add comments describing the purpose of this secret
- File:
apps/gcp/jenkins/beta/pre/secret-tidbx-docker-config.yaml(top of file) - Issue: There is no inline documentation explaining what this secret is for, which would help future readers.
- Suggestion: Add a short comment describing the purpose and usage context, e.g.:
# ExternalSecret for TiDB-X Docker authentication credentials stored in GCP Secret Manager
- File:
-
Testing and validation
- Issue: The PR description does not mention if this secret has been tested in Jenkins for proper credential injection and artifact access.
- Suggestion:
- Validate that Jenkins can consume this ExternalSecret as expected.
- Add or update any relevant integration or e2e tests to cover this secret's usage if applicable.
-
Consistency in resource naming
- File:
apps/gcp/jenkins/beta/pre/kustomization.yaml(line 11) - Issue: The new secret resource is named
secret-tidbx-docker-config.yamlfollowing the existing naming pattern, which is good. Just ensure this pattern is consistently applied in all environments where needed.
- File:
Minor style suggestions
- Align indentation under
metadata.annotationsandmetadata.labelsfor visual clarity (optional, YAML parsers are fine, but improves readability). - Consider sorting keys alphabetically within sections like
metadataandspecfor consistency.
Overall, this PR is a well-structured addition of a new external secret resource for Jenkins credentials. Addressing the minor typo and clarifying the Docker config filename will improve maintainability and reduce potential confusion. Adding comments and confirming testing will strengthen the change's robustness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds an ExternalSecret to provide TiDB-X OCI artifact authentication credentials to Jenkins. The implementation has a critical issue in how the Kubernetes secret is templated, which will prevent Jenkins from using it. There is also a minor typo in an annotation. I've provided suggestions to fix these issues.
| data: | ||
| filename: docker.config | ||
| data: "{{ .data }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure of spec.target.template.data is incorrect for creating a Kubernetes secret that Jenkins can use as a secretFile credential. The data field of a Kubernetes secret is a map of string: string, where the key is the filename and the value is the base64-encoded content. The current structure defines keys named filename and data within the secret's data, which is not the correct format.
To fix this, the data section should directly use the desired filename as the key.
data:
docker.config: "{{ .data }}"| type: Opaque | ||
| metadata: | ||
| annotations: | ||
| jenkins.io/credentials-description: docker auth credintial for TiDB-X OCI artifacts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add secret for TiDB-X OCI artifact authentication to beta pre
environment via ExternalSecret resource