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
 | 
			
		||||
name: build
 | 
			
		||||
| 
						 | 
				
			
			@ -13,8 +54,8 @@ steps:
 | 
			
		|||
    password:
 | 
			
		||||
      from_secret: dockerhub_password
 | 
			
		||||
 | 
			
		||||
#depends_on:
 | 
			
		||||
#- unit tests
 | 
			
		||||
depends_on:
 | 
			
		||||
- unit tests
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
kind: pipeline
 | 
			
		||||
| 
						 | 
				
			
			@ -73,13 +114,9 @@ steps:
 | 
			
		|||
  - echo "== pre deploy status:"
 | 
			
		||||
  - kubectl get pods --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
 | 
			
		||||
  - cat kube/beer-deployment-prod.yaml
 | 
			
		||||
  - sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/beer-deployment-prod.yaml > kube/beer-deployment-prod2.yaml
 | 
			
		||||
  - echo "applying"
 | 
			
		||||
  - cat kube/beer-deployment-prod2.yaml
 | 
			
		||||
  - kubectl apply -f kube/beer-deployment-prod2.yaml --namespace=beer
 | 
			
		||||
  - echo "== post deploy status:"
 | 
			
		||||
  - kubectl get deployments --namespace=beer
 | 
			
		||||
| 
						 | 
				
			
			@ -92,44 +129,3 @@ when:
 | 
			
		|||
  branch:
 | 
			
		||||
    include:
 | 
			
		||||
    - 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