deploy #5
					 1 changed files with 43 additions and 47 deletions
				
			
		
							
								
								
									
										90
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										90
									
								
								.drone.yml
									
									
									
									
									
								
							| 
						 | 
					@ -1,3 +1,44 @@
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					kind: pipeline
 | 
				
			||||||
 | 
					name: lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					- name: yaml lint
 | 
				
			||||||
 | 
					  image: cytopia/yamllint
 | 
				
			||||||
 | 
					  commands:
 | 
				
			||||||
 | 
					  - yamllint .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: docker lint
 | 
				
			||||||
 | 
					  image: hadolint/hadolint
 | 
				
			||||||
 | 
					  commands:
 | 
				
			||||||
 | 
					  - hadolint Dockerfile  # ignore pinning version in pip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: w3c validator
 | 
				
			||||||
 | 
					  image: validator/validator:latest
 | 
				
			||||||
 | 
					  commands:
 | 
				
			||||||
 | 
					  - vnu static/*.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: markdown lint
 | 
				
			||||||
 | 
					  image: pipelinecomponents/markdownlint:latest
 | 
				
			||||||
 | 
					  commands:
 | 
				
			||||||
 | 
					  - mdl --style all --warnings .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					kind: pipeline
 | 
				
			||||||
 | 
					name: unit tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					- name: unit test
 | 
				
			||||||
 | 
					  image: python:slim
 | 
				
			||||||
 | 
					  commands:
 | 
				
			||||||
 | 
					  - pip install -r requirements.txt
 | 
				
			||||||
 | 
					  - pip install pylint
 | 
				
			||||||
 | 
					  - pylint beer/*.py tests/*.py
 | 
				
			||||||
 | 
					  - python -m pytest tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					depends_on:
 | 
				
			||||||
 | 
					- lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
kind: pipeline
 | 
					kind: pipeline
 | 
				
			||||||
name: build
 | 
					name: build
 | 
				
			||||||
| 
						 | 
					@ -13,8 +54,8 @@ steps:
 | 
				
			||||||
    password:
 | 
					    password:
 | 
				
			||||||
      from_secret: dockerhub_password
 | 
					      from_secret: dockerhub_password
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#depends_on:
 | 
					depends_on:
 | 
				
			||||||
#- unit tests
 | 
					- unit tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
kind: pipeline
 | 
					kind: pipeline
 | 
				
			||||||
| 
						 | 
					@ -73,13 +114,9 @@ steps:
 | 
				
			||||||
  - echo "== pre deploy status:"
 | 
					  - echo "== pre deploy status:"
 | 
				
			||||||
  - kubectl get pods --namespace=beer
 | 
					  - kubectl get pods --namespace=beer
 | 
				
			||||||
  - kubectl get deployments --namespace=beer
 | 
					  - kubectl get deployments --namespace=beer
 | 
				
			||||||
  - kubectl get svc --namespace=beer
 | 
					 | 
				
			||||||
  - cat kube/beer-deployment.yaml
 | 
					 | 
				
			||||||
  - sed "s/__NAMESPACE__/$${NAMESPACE}/g" kube/beer-deployment.yaml > kube/beer-deployment-prod.yaml
 | 
					  - sed "s/__NAMESPACE__/$${NAMESPACE}/g" kube/beer-deployment.yaml > kube/beer-deployment-prod.yaml
 | 
				
			||||||
  - cat kube/beer-deployment-prod.yaml
 | 
					 | 
				
			||||||
  - sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/beer-deployment-prod.yaml > kube/beer-deployment-prod2.yaml
 | 
					  - sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/beer-deployment-prod.yaml > kube/beer-deployment-prod2.yaml
 | 
				
			||||||
  - echo "applying"
 | 
					  - echo "applying"
 | 
				
			||||||
  - cat kube/beer-deployment-prod2.yaml
 | 
					 | 
				
			||||||
  - kubectl apply -f kube/beer-deployment-prod2.yaml --namespace=beer
 | 
					  - kubectl apply -f kube/beer-deployment-prod2.yaml --namespace=beer
 | 
				
			||||||
  - echo "== post deploy status:"
 | 
					  - echo "== post deploy status:"
 | 
				
			||||||
  - kubectl get deployments --namespace=beer
 | 
					  - kubectl get deployments --namespace=beer
 | 
				
			||||||
| 
						 | 
					@ -92,44 +129,3 @@ when:
 | 
				
			||||||
  branch:
 | 
					  branch:
 | 
				
			||||||
    include:
 | 
					    include:
 | 
				
			||||||
    - master
 | 
					    - master
 | 
				
			||||||
 | 
					 | 
				
			||||||
#---
 | 
					 | 
				
			||||||
#kind: pipeline
 | 
					 | 
				
			||||||
#name: lint
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#steps:
 | 
					 | 
				
			||||||
#- name: yaml lint
 | 
					 | 
				
			||||||
#  image: cytopia/yamllint
 | 
					 | 
				
			||||||
#  commands:
 | 
					 | 
				
			||||||
#  - yamllint .
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#- name: docker lint
 | 
					 | 
				
			||||||
#  image: hadolint/hadolint
 | 
					 | 
				
			||||||
#  commands:
 | 
					 | 
				
			||||||
#  - hadolint Dockerfile  # ignore pinning version in pip
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#- name: w3c validator
 | 
					 | 
				
			||||||
#  image: validator/validator:latest
 | 
					 | 
				
			||||||
#  commands:
 | 
					 | 
				
			||||||
#  - vnu static/*.html
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#- name: markdown lint
 | 
					 | 
				
			||||||
#  image: pipelinecomponents/markdownlint:latest
 | 
					 | 
				
			||||||
#  commands:
 | 
					 | 
				
			||||||
#  - mdl --style all --warnings .
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#---
 | 
					 | 
				
			||||||
#kind: pipeline
 | 
					 | 
				
			||||||
#name: unit tests
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#steps:
 | 
					 | 
				
			||||||
#- name: unit test
 | 
					 | 
				
			||||||
#  image: python:slim
 | 
					 | 
				
			||||||
#  commands:
 | 
					 | 
				
			||||||
#  - pip install -r requirements.txt
 | 
					 | 
				
			||||||
#  - pip install pylint
 | 
					 | 
				
			||||||
#  - pylint beer/*.py tests/*.py
 | 
					 | 
				
			||||||
#  - python -m pytest tests
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#depends_on:
 | 
					 | 
				
			||||||
#- lint
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue