-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
56 lines (51 loc) · 1.51 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
pipeline {
agent any
stages {
stage('Clean workspace') {
steps{
script {
sh "rm -rf *"
}
}
}
stage('Checkout'){
steps{
git branch: 'main' , url: 'https://github.com/Aar-if/Student-Stories.git'
}
}
stage('BuildingCode') {
steps{
dir('/var/lib/jenkins/workspace/Storiesapp-student'){
sh "rm -rf node_modules"
sh "rm -rf package-lock.json"
sh "ls"
//sh "npm i --legacy-peer-deps"
sh "npm i --legacy-peer-deps"
sh "npm run build"
}
}
}
stage('Deployment') {
steps{
dir ('/var/lib/jenkins/workspace/Storiesapp-student/dist/') {
script {
def awsCliCmd = 'aws'
def bucketName = 'onest-storiesapp'
sh "aws s3 cp /var/lib/jenkins/workspace/Storiesapp-student/dist/index.html s3://${bucketName}/"
sh "aws s3 cp /var/lib/jenkins/workspace/Storiesapp-student/dist/vite.svg s3://${bucketName}/"
sh "aws s3 cp /var/lib/jenkins/workspace/Storiesapp-student/dist/assets/ s3://${bucketName}/assets/ --recursive"
}
}
}
}
// New stage for executing ccs.sh script
stage('Execute invalidation Script') {
steps {
dir('/var/lib/jenkins/workspace'){
sh 'cd /var/lib/jenkins/workspace'
sh 'sh storiesapp.sh'
}
}
}
}
}