DaoCloud / DaoCloud-docs

DaoCloud Enterprise 5.0 Documentation
https://docs.daocloud.io
Apache License 2.0
181 stars 202 forks source link

GitAuto: 应用工作台-通过git 创建,tag 需要可配置变量 #5566

Closed gitauto-ai[bot] closed 1 month ago

gitauto-ai[bot] commented 2 months ago

Resolves #1024

What is the feature

The feature is to allow the configuration of dynamic tags for Docker images built through Git, such as using a commit ID prefix.

Why we need the feature

This feature is needed to automate the tagging process of Docker images, ensuring that each build is uniquely identifiable and traceable back to a specific commit. This helps in maintaining a clear version history and simplifies the process of identifying the source of a particular image.

How to implement and why

  1. Identify the Build Process: Locate the script or configuration file responsible for building Docker images. This is likely within the scripts directory or a CI/CD configuration file.

  2. Extract Commit ID: Use Git commands to extract the current commit ID during the build process. This can be done using git rev-parse --short HEAD to get a short version of the commit ID.

  3. Modify Tagging Logic: Update the tagging logic in the build script to include the commit ID as a prefix or suffix. For example, modify the Docker build command to use docker build -t myimage:${COMMIT_ID}.

  4. Configuration Option: Allow this behavior to be configurable. This can be achieved by introducing an environment variable or a configuration file entry that enables or disables dynamic tagging.

  5. Update Documentation: Ensure that the README or any relevant documentation is updated to reflect this new feature, including instructions on how to enable and configure it.

About backward compatibility

Backward compatibility should be maintained by making the dynamic tagging feature optional. By default, the existing static tagging method should remain unchanged unless the user explicitly opts into the new dynamic tagging feature. This ensures that existing workflows are not disrupted.

Test these changes locally

git checkout -b gitauto/issue-#1024-7039c155-1e4b-4a25-9ca3-ce536c135d26
git pull origin gitauto/issue-#1024-7039c155-1e4b-4a25-9ca3-ce536c135d26
netlify[bot] commented 2 months ago

Deploy Preview for daocloud-docs ready!

Name Link
Latest commit 8d5e81db5834d95134fe56cb16e0db87eeb160ad
Latest deploy log https://app.netlify.com/sites/daocloud-docs/deploys/66e77616d106850008c2e246
Deploy Preview https://deploy-preview-5566--daocloud-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

windsonsea commented 1 month ago

not correct