From 01631a0a43ca5910c42e3cfa6d00f8c1bc10f34a Mon Sep 17 00:00:00 2001 From: Ilya Dmitrichenko Date: Wed, 16 May 2018 12:49:13 +0100 Subject: [PATCH] Add CircleCI --- .circleci/config.yml | 35 +++++++++++++++++++++++++++++++++++ skaffold.yaml | 26 ++++++++++++++++---------- 2 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9edd634 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,35 @@ +version: 2 +jobs: + + build: + docker: + - image: errordeveloper/skaffold:66cc263ef18f107adce245b8fc622a8ea46385f2 + steps: + - checkout + - setup_remote_docker: {docker_layer_caching: true} + - run: + name: Run unit tests and build the image with Skaffold + command: skaffold build --profile=test + + deploy: + docker: + - image: errordeveloper/skaffold:66cc263ef18f107adce245b8fc622a8ea46385f2 + steps: + - checkout + - setup_remote_docker: {docker_layer_caching: true} + - run: + name: Login to the registry + command: echo $REGISTRY_PASSWORD | docker login --username $REGISTRY_USERNAME --password-stdin + - run: + name: Build and push the image to the registry with Skaffold + command: skaffold build --profile=production + +workflows: + version: 2 + main: + jobs: + - build + - deploy: + requires: [build] + filters: + branches: {only: [master]} diff --git a/skaffold.yaml b/skaffold.yaml index 85a8cf7..651c4a2 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -1,27 +1,33 @@ apiVersion: skaffold/v1alpha2 kind: Config +## Default profile for use with `skaffold dev` build: - artifacts: - imageName: podinfo docker: dockerfilePath: ./Dockerfile.ci - deploy: - - kubectl: { manifests: [ deploy/skaffold/* ] } + kubectl: { manifests: [ deploy/skaffold/dev/* ] } profiles: - - name: production - + - name: test + ## This profile runs unit tests and builds the image build: - - local: { skipPush: false } + local: { skipPush: true } artifacts: - - imageName: podinfo + - imageName: stefanprodan/podinfo docker: dockerfilePath: ./Dockerfile.ci + deploy: {} # not needed here as such - deploy: {} + - name: production + ## This profile pushes the image + build: + local: { skipPush: false } + artifacts: + - imageName: stefanprodan/podinfo + docker: + dockerfilePath: ./Dockerfile.ci + deploy: {} # no-op, flux will take care of this