Skip to content

Commit

Permalink
Merge pull request #129 from Soluto/push-cli-image
Browse files Browse the repository at this point in the history
push cli docker image
  • Loading branch information
shaikatz authored Mar 28, 2019
2 parents 75398dc + e460965 commit 2c09eab
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
command: |
shellcheck -x ci/version_to_deploy.sh
shellcheck -x ci/version_to_deploy_init.sh
shellcheck -x ci/version_to_deploy_cli_docker.sh
push-api-images:
docker:
Expand Down Expand Up @@ -182,6 +183,44 @@ jobs:
command: |
git pull
git push --set-upstream origin $CIRCLE_BRANCH --tags
push-cli-image:
docker:
- image: circleci/buildpack-deps:trusty
steps:
- checkout
- setup_remote_docker
- run:
name: configure git
command: |
git config user.email "ci-build@soluto.com"
git config user.name "ci-build"
- add_ssh_keys:
fingerprints:
- "f1:c6:0c:fd:87:74:65:84:2f:6e:49:97:ec:6f:20:a5"
- run:
name: tag branch
command: |
./ci/version_to_deploy_cli_docker.sh
- run:
name: Build docker image
working_directory: "cli"
command: docker build . --build-arg CLI_VERSION=$CLI_DOCKER_TAG -t soluto/kamus-cli:$CLI_DOCKER_TAG
- run:
name: Docker push
command: |
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker push soluto/kamus-cli:$CLI_DOCKER_TAG
- run:
name: Docker push latest
command: |
docker tag soluto/kamus-cli:$CLI_DOCKER_TAG soluto/kamus-cli:latest
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker push soluto/kamus-cli:latest
- run:
name: push tags
command: |
git pull
git push --set-upstream origin $CIRCLE_BRANCH --tags
workflows:
version: 2
Expand Down Expand Up @@ -212,3 +251,11 @@ workflows:
branches:
only: master

cli-image:
jobs:
- lint-scripts
- push-cli-image:
filters:
branches:
only: master

13 changes: 13 additions & 0 deletions ci/version_to_deploy_cli_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo checking init container version
CLI_VERSION=$(grep -E "\"version\"" ./cli/package.json | grep -Eo "[0-9.]*(-rc[0-9]*)?")
CLI_TAG="cli-docker-$CLI_VERSION"
export CLI_DOCKER_TAG="latest"
if [[ "$(git tag | grep -c "$CLI_TAG")" == "0" ]]; then
echo tagging "$CLI_TAG"
git tag "$CLI_TAG"
export CLI_DOCKER_TAG=$CLI_VERSION
fi

echo "export CLI_DOCKER_TAG=$CLI_DOCKER_TAG" >> "$BASH_ENV"

0 comments on commit 2c09eab

Please sign in to comment.