Skip to content

CircleCI job for automatic deployment and execution of Integration Suite #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ workflows:
- Needs-Approval
<<: *version_tag_only

nightly:
triggers:
- schedule:
cron: "0 19 * * *"
filters:
branches:
only:
- main
jobs:
- deploy

executors:
docker-executor:
parameters:
Expand Down Expand Up @@ -215,3 +226,17 @@ jobs:
- store_artifacts:
path: /tmp/workspace/dist/
destination: dist

deploy:
executor:
name: docker-executor
python_version: "3.9"
steps:
- checkout
- setup_remote_docker:
version: 20.10.12
- run:
name: Deploy
command: |
cd .circleci/integration-tests
bash script.sh $ASTRO_BASE_DOMAIN $ASTRO_RELEASE_NAME $ASTRO_API_KEY
13 changes: 6 additions & 7 deletions .circleci/integration-tests/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ function echo_help() {
echo "Usage:"
echo "BASEDOMAIN: Astro cloud instance domain"
echo "RELEASE_NAME: Astro release name of a deployment"
echo "BUILD_NUMBER Docker image tag"
echo "API_KEY Deployment service account api key"
echo "sh script.sh <BASEDOMAIN> <RELEASE_NAME> <BUILD_NUMBER> <API_KEY>"
echo "ASTRO_API_KEY Deployment service account api key"
echo "bash script.sh <BASEDOMAIN> <RELEASE_NAME> <ASTRO_API_KEY>"
}

# Delete if source old source files exist
Expand All @@ -23,15 +22,14 @@ function clean() {
find . -name "example_*" -exec rm {} \;
}

if [ "$1" == "-h" ] || [ "$#" -ne 4 ]; then
if [ "$1" == "-h" ] || [ "$#" -ne 3 ]; then
echo_help
exit
fi

BASE_DOMAIN=$1
RELEASE_NAME=$2
BUILD_NUMBER=$3
API_KEY=$4
ASTRO_API_KEY=$3

clean

Expand All @@ -47,9 +45,10 @@ touch requirements.txt
for dag in $(find "${PROVIDER_PATH}" -type f -name 'example_*'); do cp "${dag}" "${SCRIPT_PATH}"; done;

# Build image and deploy
BUILD_NUMBER=`awk 'BEGIN {srand(); print srand()}'`
IMAGE_NAME=registry.${BASE_DOMAIN}/${RELEASE_NAME}/airflow:ci-${BUILD_NUMBER}
docker build -t "${IMAGE_NAME}" -f "${SCRIPT_PATH}"/Dockerfile "${SCRIPT_PATH}"
docker login registry.staging.astronomer.io -u _ -p "${API_KEY}"
docker login registry.staging.astronomer.io -u _ -p "${ASTRO_API_KEY}"
docker push "${IMAGE_NAME}"

clean