-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
77 lines (76 loc) · 2.4 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
pipeline {
agent {
kubernetes {
defaultContainer 'docker'
yamlFile 'pod-template/podtemplatenew.yaml'
}
}
stages {
stage('Clone innive repository and build image') {
steps {
sh 'mkdir innive-repo; chown 1000:1000 innive-repo'
dir ('innive-repo') {
git branch: 'main',
credentialsId: 'github-creds',
url: '[email protected]:Cognologix/Cognologix-AISD-Airbyte.git'
}
sh '''
dockerConfig=\${DOCKER_CONFIG:-~/.docker}
[ -d \${dockerConfig} ] && echo "Docker directory Exists" || mkdir -p \${dockerConfig}
echo '{ "credsStore" : "ecr-login" }' > \${dockerConfig}/config.json
'''
sh '''
cat /root/.docker/config.json
chown 1000:1000 -R innive-repo
cd innive-repo/innive_airflow
rm -rf innive_dbt/target/* innive_dbt/data/* innive_dbt/logs/* innive_dbt/dbt_packages/*
docker build . --network=host -f Dockerfile -t 516250856443.dkr.ecr.us-east-2.amazonaws.com/jenkins-airflow:airflow-edfi-v${BUILD_NUMBER}
docker images
docker push 516250856443.dkr.ecr.us-east-2.amazonaws.com/jenkins-airflow:airflow-edfi-v${BUILD_NUMBER}
cd -
'''
}
}
/* stage('Create Docker image') {
steps {
container('docker') {
sh """
cd /home/jenkins/agent/workspace/test-airflow2/innive-repo/Cognologix-AISD-Airbyte/innive_airflow
sh buildImage.sh edfi-airflow:2.2.3-v${BUILD_NUMBER}
docker images
cd -
"""
}
}
}*/
stage('Deploy airflow') {
steps {
sh 'mkdir airflow-charts; chown 1000:1000 airflow-charts'
dir ('airflow-charts') {
git branch: 'jenkins-env',
credentialsId: 'github-creds',
url: '[email protected]:Cognologix/airflow-helm-charts.git'
}
sh '''
chown 1000:1000 -R airflow-charts
cd airflow-charts/
helm install -f values.yaml --set defaultAirflowTag=airflow-edfi-v${BUILD_NUMBER} -n test-airflow airflow-test1 .
helm ls
cd -
'''
}
}
/* stage('Run helm') {
steps {
container('helm') {
sh "helm list"
}
}
}*/
stage('Run kubectl') {
steps {
sh "kubectl get pods -n test-airflow"
}
}
}
}