Skip to content

Commit

Permalink
fix: semantic
Browse files Browse the repository at this point in the history
  • Loading branch information
CircleCI committed Mar 10, 2022
1 parent 8343aea commit 76f4826
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 202 deletions.
190 changes: 14 additions & 176 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,199 +1,37 @@
# Jobs here are called using API, but the API is valid only for version 2 and not for version 2.1.
# The config was auto generated by CircleCI for downgrading to version 2.
# The original config is in a comment at the bottom of this file.
# https://circleci.com/docs/2.0/api-job-trigger/ ("Note: You cannot currently trigger jobs that use 2.1 config from the API.")

# How can I convert V2.1 to V2? Write the file in V2.1, run it in CircleCI and click "Configuration".

version: 2
commands:

jobs:
test:
working_directory: ~/lumigo-node-wrapper
docker:
- image: lumigo/ci:latest
auth:
username: lumigo
password: $DOCKERHUB_PASSWORD
environment:
- TZ: Asia/Jerusalem
- NODE_OPTIONS: --max_old_space_size=1500
resource_class: medium+
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: install-npm-wee
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: prettier
command: npm run prettier:ci
- run:
name: test
command: npm test
- run:
name: eslint
command: npm run lint
- run:
name: code-coverage
command: npm test --coverage && codecov
- store_artifacts:
path: coverage
prefix: coverage
be-deploy:
working_directory: ~/lumigo-node-wrapper
docker:
- image: lumigo/ci:latest
auth:
username: lumigo
password: $DOCKERHUB_PASSWORD
environment:
- TZ: Asia/Jerusalem
- NODE_OPTIONS: --max_old_space_size=4096
resource_class: medium+
steps:
- run:
command: |
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
cd ..
git clone git@github.com:lumigo-io/common-resources.git
- run:
command: |
cd ..
git clone git@github.com:lumigo-io/utils.git
- run:
command: |
cd ..
git clone git@github.com:lumigo-io/larn.git
- checkout
- run:
name: deploy env
command: ./scripts/ci_deploy.sh
integration-test:
working_directory: ~/lumigo-node-wrapper
docker:
version: 2.1
defaults: &defaults
working_directory: ~/lumigo-node-wrapper
docker:
- image: lumigo/ci:latest
auth:
username: lumigo
password: $DOCKERHUB_PASSWORD
environment:
- TZ: Asia/Jerusalem
- NODE_OPTIONS: --max_old_space_size=4096
resource_class: medium+
steps:
- run:
command: |
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
cd ..
git clone git@github.com:lumigo-io/common-resources.git
- run:
command: |
cd ..
git clone git@github.com:lumigo-io/utils.git
- run:
command: |
cd ..
git clone git@github.com:lumigo-io/larn.git
- checkout
- run:
name: npm i
command: cd ../integration-tests && npm i
- run:
name: recursive-install
command: sudo npm install -g recursive-install
- run: cd ../integration-tests && git rev-parse HEAD > ../commits && cd ../python_tracer && git rev-parse HEAD >> ../commits && cd ../lumigo-node && git rev-parse HEAD >> ../commits && cd ../java-tracer && git rev-parse HEAD >> ../commits
- restore_cache:
keys:
- IT-{{ .Branch }}-{{ checksum "../commits" }}
- run: cd ../integration-tests && ./scripts/parallel_prepare_env.sh
- run: cd ../integration-tests && ./scripts/parallel_deploy.sh --spec node
- save_cache:
key: IT-{{ .Branch }}-{{ checksum "../commits" }}
paths:
- ../integration-tests/.env
- ../integration-tests/.env2
- ../integration-tests/.env3
- ../integration-tests/.deployment_finished.env
- ../integration-tests/.deployment_finished.env2
- ../integration-tests/.deployment_finished.env3
- setup_remote_docker:
version: 19.03.13
- run:
name: run tests
command: cd ../integration-tests && export CURRENT_REPO=lumigo-node-wrapper && npm run test-parallel
no_output_timeout: 60m
- store_test_results:
path: ../integration-tests/src/test/test-results
- persist_to_workspace:
root: ../
paths:
- envs/
- stack/
- .aws/
deploy:
working_directory: ~/lumigo-node-wrapper
docker:
- image: lumigo/ci:latest
auth:
username: lumigo
password: $DOCKERHUB_PASSWORD
environment:
- TZ: Asia/Jerusalem
resource_class: medium+
steps:
- run:
command: |
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
cd ..
git clone git@github.com:lumigo-io/common-resources.git
- run:
command: |
cd ..
git clone git@github.com:lumigo-io/utils.git
- run:
command: |
cd ..
git clone git@github.com:lumigo-io/larn.git
- checkout
- run:
name: Check if tagged
command: |
tags=$(git tag -l --points-at HEAD)
echo "Tags $tags"
if [[ ! -z "$tags" ]]
then
echo "A tagged commit, skip..."
circleci step halt
fi
- run:
name: deploy to npm
command: ./scripts/bd_to_prod.sh

orbs:
lumigo-orb: lumigo/lumigo-orb@volatile

workflows:
test-deploy:
jobs:
- test:
filters:
branches:
ignore: master
- be-deploy:
- lumigo-orb/be-deploy:
filters:
branches:
ignore: master
requires:
- test
- integration-test:
- lumigo-orb/integration-test:
deploy_spec: default
tests_spec: testNormal
filters:
branches:
ignore: master
requires:
- be-deploy
- deploy:
- lumigo-orb/be-deploy
- lumigo-orb/deploy:
filters:
branches:
only: master
Expand Down
37 changes: 11 additions & 26 deletions scripts/bd_to_prod.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
#!/usr/bin/env bash
set -e

setup_git() {
git config --global user.email "no-reply@build.com"
git config --global user.name "CircleCI"
git checkout master
}

echo "Install a project with a clean state"
npm ci

echo "Build tracer"
npm run build
cp package.json lib
setup_git

echo "Setting production ad NODE_ENV"
export NODE_ENV=production

echo "Push to NPM"
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm run semantic-release

echo \{\"type\":\"Release\",\"repo\":\"${CIRCLE_PROJECT_REPONAME}\",\"buildUrl\":\"${CIRCLE_BUILD_URL}\"\} | curl -X POST "https://listener.logz.io:8071?token=${LOGZ}" -v --data-binary @-
git push origin master
echo "Creating new credential files"
enc_location=../common-resources/encrypted_files/credentials_production.enc
if [[ ! -f ${enc_location} ]]
then
echo "$enc_location not found"
exit 1
fi

mkdir -p ~/.aws
echo "${KEY}" | gpg --batch -d --passphrase-fd 0 ${enc_location} > ~/.aws/credentials
./scripts/deploy.sh --env prod
8 changes: 8 additions & 0 deletions scripts/remove.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -eo pipefail

pushd "$(dirname "$0")" &> /dev/null
# Go back one spot because we are on scripts dir. The other scripts assume you are in the root folder
cd ..
../utils/common_bash/defaults/remove.sh "lumigo-tracer-extension" $*
popd &> /dev/null

0 comments on commit 76f4826

Please sign in to comment.