Hi guys, I am trying to configure a jira orb. Ideally I want it to show it on jira when a deplpyment is done to DEV, STG, {several prod customer envs}.
Here is my file. Redacted version
version: 2.1
orbs:
slack: circleci/slack@4.3.0
jira: circleci/jira@1.3.1
references:
interpolate_environment_variables: &interpolate_environment_variables
run:
name: Interpolate Environment Variables
command: |
echo 'set -o allexport' >> ${BASH_ENV}
echo 'ROK8S_INSTALL_PATH=${HOME}/rok8s-scripts' >> ${BASH_ENV}
echo 'PATH=$PATH:${HOME}/google-cloud-sdk/bin:node_modules/.bin:${HOME}/rs-scripts' >> ${BASH_ENV}
echo 'CI_SHA1=$CIRCLE_SHA1' >> ${BASH_ENV}
echo 'CI_BRANCH=$CIRCLE_BRANCH' >> ${BASH_ENV}
echo 'CI_BUILD_NUM=$CIRCLE_BUILD_NUM' >> ${BASH_ENV}
echo 'CI_TAG=$CIRCLE_TAG' >> ${BASH_ENV}
echo 'PREVIOUS_COMMIT=$(git rev-parse HEAD~1)' >> ${BASH_ENV}
echo 'REPOSITORY_NAME=$DOCKERTAG' >> ${BASH_ENV}
echo 'NGINX_REPO_NAME=nginx-assets' >> ${BASH_ENV}
echo 'POSTGRES_DB=$DATABASE_NAME' >> ${BASH_ENV}
echo 'POSTGRES_USER=$DATABASE_USERNAME' >> ${BASH_ENV}
echo 'set +o allexport' >> ${BASH_ENV}
install dependencies: &install_dependencies
run:
name: Install dependencies
command: |
sudo apt-get -y -qq update
sudo apt-get -y -qq install postgresql-client
sudo apt-get -y -qq install python-pip python-dev
sudo pip install --upgrade pip
mkdir -p ${RS_INSTALL_PATH}
sudo npm install -g rok8s-scripts@7.9.1
sudo pip install awscli
install-rok8s-requirements
eval "$(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email)"
sudo apt-get install xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2
bundle_install: &bundle_install
run:
name: Install gems with bundler
command: |
bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
yarn_install: &yarn_install
run:
name: Install node modules with yarn
command: |
yarn install --production
prepare_db: &prepare_db
run:
name: Copy Database yml file
command: |
cp config/database.yml.sample config/database.yml
prepare_asset_checksum: &prepare_asset_checksum
run:
name: Generate asset checksum
command: |
git log --pretty=format:'%H' -n 1 -- app/assets > assets_checksum
git log --pretty=format:'%H' -n 1 -- lib/assets >> assets_checksum
git log --pretty=format:'%H' -n 1 -- vendor/assets >> assets_checksum
git log --pretty=format:'%H' -n 1 -- public/assets >> assets_checksum
git log --pretty=format:'%H' -n 1 -- app/javascript >> assets_checksum
cat assets_checksum
precompile_assets: &precompile_assets
run:
name: Precompile assets
command: |
bundle exec rake assets:precompile --trace
airbrake_deploy: &airbrake_deploy
run:
name: Send deploy flag to Airbrake
command: |
curl -X POST \
-H "Content-Type: application/json" \
-d '{"environment":"'${ENVIRONMENT}'","username":"'${CIRCLE_USERNAME}'","repository":"https://github.com/xx"}' \
"https://arake.io/api/v4/projef91bb9b438e91257b61bfb"
curl -u $BRANCH_DASHBOARD_USER:$BRANCH_DASHBOARD_PASS "?user=$CIRCLE_USERNAME&name=$CIRCLE_BRANCH&env=$ENVIRONMENT"
setup_cc_test_reporter: &setup_cc_test_reporter
run:
name: Setup Code Climate test-reporter
command: |
mkdir -p ~/tmp
curl -L https://ter/test-reporter-latest-linux-amd64 > ~/tmp/cc-test-reporter
chmod +x ~/tmp/cc-test-reporter
upload_coverage: &upload_coverage
run:
name: Upload coverage results to Code Climate
command: |
~/tmp/cc-test-reporter sum-coverage --output - ~/tmp/codeclimate.*.json | ~/tmp/cc-test-reporter upload-coverage --debug --input -
run_tests: &run_tests
run:
name: Run tests
command: |
mkdir ~/rspec
RAILS_ENV=test bundle exec rails db:setup
bundle exec rspec --format progress --format RspecJunitFormatter -o ~/rspec/rspec.xml
~/tmp/cc-test-reporter format-coverage -t simplecov -o ~/tmp/codeclimate.backend.json coverage/backend/.resultset.json
check_db_integrity: &check_db_integrity
run:
name: Check DB Integrity
command: |
bundle exec rails db:environment:set RAILS_ENV=test
RAILS_ENV=test bundle exec rails db:drop
RAILS_ENV=test bundle exec rails db:create
RAILS_ENV=test bundle exec rails db:migrate
build_image: &build_image
run:
name: Build image
command: |
PREVIOUS_COMMIT=$(git rev-parse HEAD~1)
docker-pull -f deploy/build.config
docker build --cache-from "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${REPOSITORY_NAME}:${CI_BRANCH}" \
--cache-from "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${REPOSITORY_NAME}:${PREVIOUS_COMMIT}" \
--build-arg BUNDLE_GEMS__CONTRIBSYS__COM=$BUNDLE_GEMS__CONTRIBSYS__COM \
--rm=false -t "${DOCKERTAG}:latest" \
--file=Dockerfile .
docker build --rm=false -t "${NGINX_REPO_NAME}:latest" \
--file=Dockerfile.nginx .
push_image: &push_image
run:
name: Push image
command: |
docker-push -f deploy/build.config
docker tag "${NGINX_REPO_NAME}:latest" "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${NGINX_REPO_NAME}:${CI_SHA1}"
docker push "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${NGINX_REPO_NAME}:${CI_SHA1}"
set_kubectl_context: &set_kubectl_context
run:
name: Set context
command: |
prepare-kubectl
kubectl config use-context ${CONTEXT}
deploy: &deploy
run:
name: Deploy
command: |
k8s-deploy -f deploy/${ENVIRONMENT}.config
run_cypress: &run_cypress
run:
name: Run Cypress Suit
command: |
CYPRESS_BASE_URL=$base_url yarn run percy exec -- cypress run --record --key 161f641b-e850-400b-93e7-99172e71404b --env $employer
tag_and_release_image: &tag_and_release_image
run:
name: Tag and release image
command: |
docker pull "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${DOCKERTAG}:${CI_SHA1}"
docker tag "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${DOCKERTAG}:${CI_SHA1}" "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${DOCKERTAG}:${CIRCLE_TAG}"
docker push "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${DOCKERTAG}:${CIRCLE_TAG}"
build_and_push_steps: &build_and_push_steps
steps:
- checkout
- setup_remote_docker
- *interpolate_environment_variables
- *install_dependencies
- *setup_cc_test_reporter
- restore_cache:
keys:
- gem-cache-{{ arch }}-{{ checksum "Gemfile.lock" }}
- *bundle_install
- save_cache:
key: gem-cache-{{ arch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- restore_cache:
keys:
- yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
- *yarn_install
- save_cache:
key: yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- *prepare_db
- *prepare_asset_checksum
- restore_cache:
keys:
- asset-cache-v2-{{ arch }}-{{ checksum "assets_checksum" }}
- *precompile_assets
- save_cache:
key: asset-cache-v2-{{ arch }}-{{ checksum "assets_checksum" }}
paths:
- public/assets
- tmp/cache/assets/sprockets
- tmp/cache/webpacker
- public/packs
- *check_db_integrity
- *run_tests
- *upload_coverage
- store_test_results:
path: ~/rspec
- store_artifacts:
path: coverage
- *build_image
- *push_image
tag_steps: &tag_steps
steps:
- checkout
- setup_remote_docker
- *interpolate_environment_variables
- *install_dependencies
- *tag_and_release_image
deploy_steps: &deploy_steps
steps:
- checkout
- setup_remote_docker
- *interpolate_environment_variables
- *install_dependencies
- *set_kubectl_context
- *deploy
- *airbrake_deploy
- jira/notify
- slack/notify:
branch_pattern: master
channel: CHH9BNB61
event: fail
mentions: '@dev, @tt, @ai'
template: basic_fail_1
deploy_with_cypress_steps: &deploy_with_cypress_steps
steps:
- checkout
- setup_remote_docker
- *interpolate_environment_variables
- *install_dependencies
- *set_kubectl_context
- *deploy
- *airbrake_deploy
- run:
name: Install node modules with yarn (for percy)
command: |
yarn install
- *run_cypress
build_job_defaults: &build_job_defaults
<<: *defaults
docker:
- image: circleci/ruby:2.6.5-stretch-node
- image: circleci/postgres:9.5.6-alpine
environment:
POSTGRES_USER: 'pxs'
POSTGRES_DB: 'pxs_test'
resource_class: medium+
deploy_job_defaults: &deploy_job_defaults
<<: *defaults
docker:
- image: circleci/ruby:2.6.5-stretch-node
jobs:
build:
<<: *build_job_defaults
<<: *build_and_push_steps
tag-release:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: production
<<: *tag_steps
deploy-dev:
<<: *deploy_job_defaults
environment:
CONTEXT: development
ENVIRONMENT: development
<<: *deploy_steps
deploy-newdev:
<<: *deploy_job_defaults
environment:
CONTEXT: development
ENVIRONMENT: newdev
<<: *deploy_steps
- jira/notify:
environment_type: newdev
job_type: deployment
deploy-test:
<<: *deploy_job_defaults
environment:
CONTEXT: development
ENVIRONMENT: test
<<: *deploy_steps
deploy-staging:
<<: *deploy_job_defaults
environment:
CONTEXT: staging
ENVIRONMENT: staging
<<: *deploy_steps
deploy-cypress:
<<: *deploy_job_defaults
environment:
CONTEXT: staging
ENVIRONMENT: cypress
<<: *deploy_with_cypress_steps
deploy-pxs:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: production
<<: *deploy_steps
deploy-p:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: p
<<: *deploy_steps
deploy-preprod:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: preprod
<<: *deploy_steps
deploy-pxswwwdsddsf:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: pxswwwdsddsf
<<: *deploy_steps
deploy-mba:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: mba
<<: *deploy_steps
deploy-pxswwwdsd:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: pxswwwdsd
<<: *deploy_steps
deploy-pxswww:
<<: *deploy_job_defaults
environment:
CONTEXT: production
ENVIRONMENT: pxswww
<<: *deploy_steps
workflows:
version: 2
build_default:
jobs:
- build:
filters:
tags:
ignore:
- /^v.*/
branches:
ignore:
- /ro\/r-kubernetes-onboarding/
- hold-dev:
type: approval
requires:
- build
- hold-newdev:
type: approval
requires:
- build
- hold-test:
type: approval
requires:
- build
- hold-staging:
type: approval
requires:
- build
- hold-cypress:
type: approval
requires:
- build
- deploy-dev:
requires:
- hold-dev
- deploy-newdev:
requires:
- hold-newdev
- deploy-test:
requires:
- hold-test
- deploy-staging:
requires:
- hold-staging
- deploy-cypress:
context: cypress-staging
requires:
- hold-cypress
build_master:
jobs:
- build:
filters:
branches:
only: master
- hold-pxs:
type: approval
requires:
- build
- hold-preprod:
type: approval
requires:
- build
- hold-p:
type: approval
requires:
- build
- hold-pxswwwdsddsf:
type: approval
requires:
- build
- hold-pxswwwdsd:
type: approval
requires:
- build
- hold-mba:
type: approval
requires:
- build
- hold-pxswww:
type: approval
requires:
- build
- deploy-pxs:
requires:
- hold-pxs
- deploy-p:
requires:
- hold-p
- deploy-preprod:
requires:
- hold-preprod
- deploy-pxswwwdsddsf:
requires:
- hold-pxswwwdsddsf
- deploy-mba:
requires:
- hold-mba
- deploy-pxswwwdsd:
requires:
- hold-pxswwwdsd
- deploy-pxswww:
requires:
- hold-pxswww
# Add deploy configuration for pxswwwdsddsf, mba
tag_release:
jobs:
- tag-release:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- hold-pxs:
type: approval
requires:
- tag-release
- hold-p:
type: approval
requires:
- tag-release
- hold-preprod:
type: approval
requires:
- tag-release
- deploy-pxs:
requires:
- hold-pxs
- deploy-p:
requires:
- hold-p
- deploy-preprod:
requires:
- hold-preprod
Lets say that I want to have a notification related to “NEWDEV” deployement. ie deployemtn on ob of my env called as “Newdev”, circleci throws and error of expected type: String, found: Mapping