My current workflow is to build, push Docker image and then deploy over SSH. Despite already setting up variables within project and context settings, I still can’t access them through bash shell or set in parameters of using orbs. Below is my config, if there is anything wrong pls let me know. Thanks in advance.
version: 2.1
orbs:
docker: circleci/docker@2.1.4
slack: circleci/slack@4.10.1
jobs:
build-and-push-image:
executor: docker/docker
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- docker/check
- docker/build:
image: $DOCKER_LOGIN/$CIRCLE_PROJECT_REPONAME
tag: $CIRCLECI_BRANCH
debug: true
use-buildkit: true
- docker/push:
image: $DOCKER_LOGIN/$CIRCLE_PROJECT_REPONAME
- slack/notify:
event: pass
chanel: $SLACK_DEFAULT_CHANNEL
template: basic_success_1
- slack/notify:
event: fail
chanel: $SLACK_DEFAULT_CHANNEL
template: basic_fail_1
deploy-dev:
machine: true
environment:
DEPLOY_DIR: docker-apps/handbooq-nodejs
steps:
- add_ssh_keys:
fingerprints:
- "host fingerprint"
- run:
name: Deploy Over SSH
command: |
ssh $REMOTE_USER@$DEV_HOST -v -t "cd $DEPLOY_DIR; docker pull $DOCKER_LOGIN/$CIRCLE_PROJECT_REPONAME:$CIRCLE_BRANCH"
workflows:
dev:
jobs:
- build-and-push-image:
context:
- handbooq
- build-env-vars
- docker-hub-creds
- deploy-dev:
requires:
- build-and-push-image
filters:
branches:
only:
- my branch
context:
- handbooq
- build-env-vars
- docker-hub-creds