„.drone.yml“ ändern
continuous-integration/drone/push Build is passing Details

This commit is contained in:
an 2019-07-30 19:32:12 +00:00
parent 0150d47429
commit 826eebf097
1 changed files with 21 additions and 39 deletions

View File

@ -1,39 +1,21 @@
pipeline: kind: pipeline
prebuild: name: default
image: golang:latest
commands: steps:
- IMAGE=dr.dnix.de/$DRONE_REPO_NAME - name: prebuild
- REV=$(git rev-list HEAD --count) image: golang:latest
- BUILDDATE=$(date) commands:
- BRANCH=$DRONE_COMMIT_BRANCH - IMAGE=dr.dnix.de/$DRONE_REPO_NAME
- TAGS=.tags - REV=$(git rev-list HEAD --count)
- echo "Building image $IMAGE:$BRANCH-$REV" - BUILDDATE=$(date)
- echo -n "$BRANCH-$REV" >$TAGS - BRANCH=$DRONE_COMMIT_BRANCH
- cat $TAGS - TAGS=.tags
build_docker: - echo "Building image $IMAGE:$BRANCH-$REV"
image: plugins/docker - echo -n "$BRANCH-$REV" >$TAGS
repo: dr.dnix.de/${DRONE_REPO_NAME} - cat $TAGS
tags: - name: docker
- latest image: plugins/docker
deploy: settings:
image: ubuntu:16.04 repo: dr.dnix.de/${DRONE_REPO_NAME}
secrets: tags:
- K8S_SSH_PRIVATE_KEY - latest
- K8S_SSH_PUBLIC_KEY
commands:
- apt update
- apt -y upgrade
- apt install -y git
- IMAGE=dr.dnix.de/$DRONE_REPO_NAME
- BRANCH=$DRONE_COMMIT_BRANCH
- REV=$(git rev-list HEAD --count)
- echo "Deploying image $IMAGE:$BRANCH-$REV"
- cd ~
- mkdir .ssh
- chmod 700 .ssh
- echo "$K8S_SSH_PRIVATE_KEY" >.ssh/id_rsa
- chmod 600 .ssh/id_rsa
- echo "$K8S_SSH_PUBLIC_KEY" >.ssh/id_rsa.pub
- chmod 600 .ssh/id_rsa.pub
- ssh -oStrictHostKeyChecking=no root@master01 "kubectl set image deployment/image-transformer image-transforめer=dr.dnix.de/image-transformer:$BRANCH-$REV -n dnix-image-transformer"
- ssh -oStrictHostKeyChecking=no root@master01 "kubectl rollout status deployment/image-transformer -n image-transformer"