O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Build pipelines with bitbucket for Magento

675 visualizações

Publicada em

Bitbucket pipelines is a powerful tool for web applications. In this presentation I introduce the concept of pipeline and use Magento as an example.

This was a demo and talk at DevOps Automation Summit July 20, 2018. https://1point21gws.com/devops/bangalore/

Publicada em: Software
  • Entre para ver os comentários

  • Seja a primeira pessoa a gostar disto

Build pipelines with bitbucket for Magento

  1. 1. Build pipelines Using Atlassian / Bitbucket Pradip Shah Founder, luroConnect devops, performance, scale and security Wordpress & Magento
  2. 2. Devops solves the wall of conflict
  3. 3. A key manifestation of the wall of conflict
  4. 4. Devops fixes this by CI/CD
  5. 5. Pipelines vs traditional CI • Pipelines enhances traditional CI • Steps for targets • Reduces cost of running a CI by containerizing CI • Pipelines should encompass CI and CD • Continous Integration • Builds ability to deliver at will • Continous Delivery • Ability to automate the delivery
  6. 6. Bitbucket Pipelines
  7. 7. Bitbucket Pipelines Promise
  8. 8. Bitbucket Pipelines • Bitbucket Pipelines runs pipelines using Docker containers. • Use the validator to check format https://bitbucket-pipelines.prod.public.atl-paas.net/validator.html Name The name of the file must be bitbucket-pipelines.yml Location The file must be located in the root directory of the repository that you want to build. Format The content of the file must be compliant with our bitbucket-pipelines.yml guidelines
  9. 9. YAML : Quick overview • Key value pairs in the familiar key: value syntax • Value can also be a associative array – set of key values either in curly braces or one per line • Value can be a list [item, item] OR each item starts with a hyphen • Indentation is important • Indentation is spaces • # makes a comment to the end of line
  10. 10. Defining pipelines contd • You can define the following types of pipelines in the bitbucket- pipelines.yml file: • default • branches • tags • custom • You can refer to branches, tags, and bookmarks in a pipeline using their name, or by using glob patterns. • If you want to trigger some build pipelines manually, you can add them in the custom section. • Every pipeline can have up to 10 steps. Each step contains a script which defines the actions that should be performed to execute a build.
  11. 11. Keywords in a bitbucket pipeline
  12. 12. Our Demo : Magento 2 application • In order to move code to production Magento requires • Deploy static (less->css) • Compile (moves files to generated, resolves conflicts, some checks) • Optionally • Do more checks • Minify css / js / (static) html • Run tests
  13. 13. steps • Steps are executed in the order that they appear in the bitbucket- pipelines.yml file, • Each step runs in separate Docker container • Use artifacts to pass built folders down to next step Each step can be configured to: • Use a different Docker image. • Use specific caches • Uses services • Produce artifacts that subsequent steps can consume.
  14. 14. Note on separation of concerns • There is an overlap on what can be done in a step and in docker • Docker Image • Closely match a environment you want the application to run in • Pipeline • Specific to the application • Focus on build steps rather than image • Might be a good idea to put the Dockerfile(s) in use in the git
  15. 15. Service : mysql • Mysql will be a separate docker instance called a service instance • Ofcourse you can make a single docker image with mysql but that would break the idea of containerization • Bitbucketpipeline maps ALL ports from the service to the main instance Main Instance Running pipeline Service 1 : mysql Service 2 : redis :5903 :6380 5 9 0 3 6 3 8 0
  16. 16. Security of passwords • Use environment variables for things like AWS keys, clusterinfo, docker user, etc. • Environment variabes are at the project level • Use keys to ssh to • get authentication files from a remote server • ssh to deploy built objects
  17. 17. Docker build a container and push • Simply • docker login –u $DOCKER_LOGIN –p $DOCKER_PASSWORD • docker build –t luroConnect/M2:$BITBUCKET_COMMIT • docker push luroConnect/M2:$BITBUCKET_COMMIT
  18. 18. Conclusion • Devops aims to banish “It works on my machine” syndrome • Breaks barriers between developer and operations • Bitbucket Pipelines help speed up the process • Using docker it reduces the cost of each test and improved turnaround
  19. 19. Resources used in this presentation • Docker Image used in the pipeline https://hub.docker.com/r/luroconnect/bitbucket-pipeline-magento2/ • Bitbucket pipeline yaml file https://bitbucket.org/rrap/magento2/src/master/bitbucket- pipelines.yml See the branch for variation
  20. 20. Where to find us http://www.luroConnect.com/ info@luroConnect.com @luroconnect