-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Pull the data from QA #54
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
base: master
Are you sure you want to change the base?
Changes from all commits
5051baf
81c0cf7
c8f0249
6706f9a
e45ba7f
ce10b0b
c9a7a62
4260c85
8723010
9c7afc8
cd151f0
67e4e76
1605c31
79563df
89f4f62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||
| trigger: | ||||||
| - none | ||||||
|
|
||||||
| resources: | ||||||
| pipelines: | ||||||
| - pipeline: BuildPipeline # Reference to the build pipeline that creates the artifact | ||||||
| source: 'Salmanjutt79.two-tier-flask-app' # Name of the build pipeline | ||||||
| trigger: true # Automatically trigger on new builds | ||||||
|
|
||||||
| stages: | ||||||
| - stage: Deploy | ||||||
| displayName: Deploy Docker Compose | ||||||
| jobs: | ||||||
| - job: Deploy | ||||||
| displayName: Deploy | ||||||
| pool: | ||||||
| name: Default | ||||||
| steps: | ||||||
| - download: BuildPipeline # Download the artifact from the build pipeline | ||||||
| artifact: 'docker-compose-artifact' # Name of the artifact published by the build pipeline | ||||||
|
|
||||||
|
|
||||||
| - task: DockerCompose@0 | ||||||
| displayName: Deploy with Docker Compose | ||||||
| inputs: | ||||||
| action: 'Run services' | ||||||
| dockerComposeFile: '/home/worker/myagent/_work/5/BuildPipeline/docker-compose-artifact/docker-compose.yml' | ||||||
| projectName: 'flaskapp' # Replace with your project name if necessary | ||||||
| dockerRegistryEndpoint: 'Dockerhub-connection' # Specify your Docker registry connection here | ||||||
| additionalImageTags: | | ||||||
| $(tag) | ||||||
| dockerComposePath: '/usr/local/bin/docker-compose' | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove hardcoded docker-compose path The docker-compose executable path should be determined by the agent's environment. - dockerComposePath: '/usr/local/bin/docker-compose'
+ dockerComposePath: '$(which docker-compose)'📝 Committable suggestion
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||
| trigger: | ||||||
| - master | ||||||
|
|
||||||
| pool: | ||||||
| name: 'Default' | ||||||
|
|
||||||
| steps: | ||||||
| - task: DownloadBuildArtifacts@0 | ||||||
| displayName: 'Download Docker images artifact' | ||||||
| inputs: | ||||||
| buildType: 'specific' | ||||||
| project: '$(System.TeamProjectId)' | ||||||
| pipeline: 'Salmanjutt79.two-tier-flask-app (2)' # Replace with the name of your CI pipeline | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove hardcoded pipeline reference The pipeline reference should be parameterized to support different environments. - pipeline: 'Salmanjutt79.two-tier-flask-app (2)' # Replace with the name of your CI pipeline
+ pipeline: '$(CI_PIPELINE_NAME)'📝 Committable suggestion
Suggested change
|
||||||
| buildVersionToDownload: 'latest' | ||||||
| downloadPath: '$(System.ArtifactsDirectory)/docker-images' | ||||||
| artifactName: 'docker-images' | ||||||
|
|
||||||
| - task: DockerCompose@0 | ||||||
| displayName: 'Deploy Docker images' | ||||||
| inputs: | ||||||
| action: 'Run services' | ||||||
| dockerComposeFile: 'docker-compose.yml' | ||||||
| projectName: 'myapp' | ||||||
|
|
||||||
| additionalImageTags: 'latest' | ||||||
| containerRegistryType: 'Container Registry' | ||||||
| dockerRegistryEndpoint: 'Dockerhub-connection' | ||||||
| #artifactName: 'docker-images' # Replace with your Docker registry connection name | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||
| # Use the official MySQL 5.7 image as the base image | ||||||||||||||||||||
| FROM mysql:5.7 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Set environment variables | ||||||||||||||||||||
| ENV MYSQL_DATABASE=mydb | ||||||||||||||||||||
| ENV MYSQL_USER=root | ||||||||||||||||||||
| ENV MYSQL_ROOT_PASSWORD=admin | ||||||||||||||||||||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Avoid using root user for MySQL Using the root user for database operations poses a significant security risk. Create a dedicated database user with limited privileges instead. -ENV MYSQL_USER=root
+ENV MYSQL_USER=app_user
Comment on lines
+5
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security: Move credentials to environment variables Hardcoding credentials in Dockerfile is a security risk. Use build arguments or environment variables instead. -ENV MYSQL_DATABASE=mydb
-ENV MYSQL_USER=root
-ENV MYSQL_ROOT_PASSWORD=admin
+ARG MYSQL_DATABASE
+ARG MYSQL_USER
+ARG MYSQL_ROOT_PASSWORD
+ENV MYSQL_DATABASE=${MYSQL_DATABASE}
+ENV MYSQL_USER=${MYSQL_USER}
+ENV MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| # Expose port 3306 to allow external connections | ||||||||||||||||||||
| EXPOSE 3306 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Start MySQL server | ||||||||||||||||||||
| CMD ["mysqld"] | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,3 +33,5 @@ def submit(): | |
| if __name__ == '__main__': | ||
| app.run(host='0.0.0.0', port=5000, debug=True) | ||
|
|
||
| #update app.py fiile | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||
| trigger: | ||||||
| - master | ||||||
|
|
||||||
| pool: | ||||||
| name: 'Default' | ||||||
|
|
||||||
| steps: | ||||||
| - task: DockerCompose@0 | ||||||
| displayName: 'Build Docker images' | ||||||
| inputs: | ||||||
| action: 'Build services' | ||||||
| dockerComposeFile: 'docker-compose.yml' | ||||||
| additionalImageTags: 'latest' | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Implement proper version tagging strategy Using only 'latest' tag is risky for production deployments. Consider adding git commit SHA or build number. - additionalImageTags: 'latest'
+ additionalImageTags: '$(Build.BuildNumber),latest'📝 Committable suggestion
Suggested change
|
||||||
|
|
||||||
| projectName: 'myapp' | ||||||
|
|
||||||
| - task: PublishBuildArtifacts@1 | ||||||
| displayName: 'Publish Docker images as artifacts' | ||||||
| inputs: | ||||||
| PathtoPublish: '$(Build.SourcesDirectory)' | ||||||
| ArtifactName: 'docker-images' | ||||||
|
Comment on lines
+20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Optimize artifact publishing Publishing the entire source directory - PathtoPublish: '$(Build.SourcesDirectory)'
+ PathtoPublish: '$(Build.SourcesDirectory)/docker-compose.yml'
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
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.
🛠️ Refactor suggestion
Remove hardcoded paths
The docker-compose file path should use pipeline variables instead of hardcoded paths.
📝 Committable suggestion