Skip to content

Commit 71fa41b

Browse files
authored
Run the Integration tests nightly (#207)
Automate cloud deployment from circleci. I have created a new workflow called nightly and a job deploy which runs at the scheduled time, at present, it will run daily around 0:0:0 IST and deploy main branch on the cloud. The integration test script now depends on env variable which comes from circleci for scheduled workflow.
1 parent 4eb9ffe commit 71fa41b

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

.circleci/config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ workflows:
5252
- Needs-Approval
5353
<<: *version_tag_only
5454

55+
nightly:
56+
triggers:
57+
- schedule:
58+
cron: "0 19 * * *"
59+
filters:
60+
branches:
61+
only:
62+
- main
63+
jobs:
64+
- deploy
65+
5566
executors:
5667
docker-executor:
5768
parameters:
@@ -215,3 +226,17 @@ jobs:
215226
- store_artifacts:
216227
path: /tmp/workspace/dist/
217228
destination: dist
229+
230+
deploy:
231+
executor:
232+
name: docker-executor
233+
python_version: "3.9"
234+
steps:
235+
- checkout
236+
- setup_remote_docker:
237+
version: 20.10.12
238+
- run:
239+
name: Deploy
240+
command: |
241+
cd .circleci/integration-tests
242+
bash script.sh $ASTRO_BASE_DOMAIN $ASTRO_RELEASE_NAME $ASTRO_API_KEY

.circleci/integration-tests/script.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ function echo_help() {
88
echo "Usage:"
99
echo "BASEDOMAIN: Astro cloud instance domain"
1010
echo "RELEASE_NAME: Astro release name of a deployment"
11-
echo "BUILD_NUMBER Docker image tag"
12-
echo "API_KEY Deployment service account api key"
13-
echo "sh script.sh <BASEDOMAIN> <RELEASE_NAME> <BUILD_NUMBER> <API_KEY>"
11+
echo "ASTRO_API_KEY Deployment service account api key"
12+
echo "bash script.sh <BASEDOMAIN> <RELEASE_NAME> <ASTRO_API_KEY>"
1413
}
1514

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

26-
if [ "$1" == "-h" ] || [ "$#" -ne 4 ]; then
25+
if [ "$1" == "-h" ] || [ "$#" -ne 3 ]; then
2726
echo_help
2827
exit
2928
fi
3029

3130
BASE_DOMAIN=$1
3231
RELEASE_NAME=$2
33-
BUILD_NUMBER=$3
34-
API_KEY=$4
32+
ASTRO_API_KEY=$3
3533

3634
clean
3735

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

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

5554
clean

0 commit comments

Comments
 (0)