kind: pipeline type: docker name: default steps: - name: static_analysis image: python:3 commands: - pip3 install pylint bandit mccabe - pip3 install -r requirements.txt - find . -name "*.py" -exec python3 -m py_compile '{}' \; - find . -name "*.py" -exec pylint '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi - find . -name "*.py" -exec python3 -m mccabe --min 3 '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi - bandit -r . + || if [ $? -eq 1 ]; then echo "you fail"; fi - name: build image: docker:stable-dind volumes: - name: dockersock path: /var/run environment: DOCKER_USERNAME: from_secret: DOCKER_USERNAME DOCKER_PASSWORD: from_secret: DOCKER_PASSWORD commands: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin registry.kmlabz.com - docker build -t="registry.kmlabz.com/$DOCKER_USERNAME/$DRONE_REPO_NAME" . - docker build -t="registry.kmlabz.com/$DOCKER_USERNAME/$DRONE_REPO_NAME:$DRONE_BUILD_NUMBER" . - docker push "registry.kmlabz.com/$DOCKER_USERNAME/$DRONE_REPO_NAME" - docker push "registry.kmlabz.com/$DOCKER_USERNAME/$DRONE_REPO_NAME:$DRONE_BUILD_NUMBER" services: - name: docker image: docker:stable-dind privileged: true volumes: - name: dockersock path: /var/run volumes: - name: dockersock temp: {}