Skip to content

Commit a247db8

Browse files
Dev (#42)
* feat: added Jenkinsfile * Josvctorsnchez/sc 71552/migrar a jenkins repos de plugins (#40) * feat: added custom version release * fix expresion * fix: expresion and test * test manual approval * test manual approval * test manual approval * fix credentials aws Co-authored-by: josevictorsanchez <[email protected]> Co-authored-by: josevictorsanchez <[email protected]>
1 parent 9d362ff commit a247db8

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

Jenkinsfile

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pipeline {
2929
}
3030
environment {
3131
SONAR_TEST = credentials('SONAR_TEST')
32+
WORDPRESS_USERNAME = credentials('WORDPRESS_USERNAME')
33+
WORDPRESS_PASSWORD = credentials('WORDPRESS_PASSWORD')
3234
CODE_SOURCE_DEFAULT = "plugin"
3335
}
3436
steps {
@@ -50,7 +52,14 @@ pipeline {
5052
CACHE_KEY = 'v1-dependencies-' + HASH
5153

5254
container('php') {
53-
loadCache(CACHE_KEY)
55+
sh """
56+
load-config
57+
export AWS_PROFILE=AplazameSharedServices
58+
set -e
59+
aws s3 cp --quiet s3://aplazameshared-jenkins-cache/Aplazame-Backend/woocommerce/${CACHE_KEY} cache.tar.gz || exit 0
60+
[ -f cache.tar.gz ] && tar -xf cache.tar.gz
61+
"""
62+
//loadCache(CACHE_KEY)
5463
}
5564
}
5665
}
@@ -77,7 +86,15 @@ pipeline {
7786
}
7887
steps {
7988
container('php') {
80-
saveCache(CACHE_KEY,["${foldersCache}"])
89+
sh """
90+
load-config
91+
export AWS_PROFILE=AplazameSharedServices
92+
set -e
93+
MATCHES=\$(aws s3 ls s3://aplazameshared-jenkins-cache/Aplazame-Backend/woocommerce/${CACHE_KEY} | wc -l)
94+
[ "\$MATCHES" = "0" ] && [ ! -f cache.tar.gz ] && tar -czf cache.tar.gz vendor/ && aws s3 cp --quiet cache.tar.gz s3://aplazameshared-jenkins-cache/Aplazame-Backend/woocommerce/${CACHE_KEY}
95+
exit 0
96+
"""
97+
//saveCache(CACHE_KEY,["${foldersCache}"])
8198
}
8299
}
83100
}
@@ -136,8 +153,10 @@ pipeline {
136153
}
137154
container('php') {
138155
sh """
139-
echo "Deploy to S3"
140-
#aws s3 cp --acl public-read aplazame.latest.zip s3://aplazame/modules/prestashop/
156+
echo "Deploy to S3"
157+
load-config
158+
export AWS_PROFILE=Aplazame
159+
aws s3 cp --acl public-read aplazame.latest.zip s3://aplazame/modules/woocommerce/
141160
"""
142161
}
143162
}
@@ -174,7 +193,10 @@ pipeline {
174193
container('php') {
175194
sh """
176195
echo "***************Create Release***************"
177-
#gh release create v$BUILD_NUMBER --notes "Release created by Jenkins.<br />Build: $BUILD_TAG;$BUILD_URL&gt;"
196+
export APP_VERSION="\$(cat Makefile | grep 'version ?=' | cut -d '=' -f2)"
197+
echo \$APP_VERSION
198+
echo "\$APP_VERSION" > APP_VERSION.tmp
199+
gh release create \$APP_VERSION --notes "Release created by Jenkins.<br />Build: $BUILD_TAG;$BUILD_URL&gt;"
178200
"""
179201
}
180202
}
@@ -209,12 +231,16 @@ pipeline {
209231
"""
210232
sh """
211233
echo "****************Tag Release******************************"
212-
#svn cp svn/trunk svn/tags/$BUILD_TAG:1
234+
export APP_VERSION="\$(cat APP_VERSION.tmp)"
235+
echo \$APP_VERSION
236+
svn cp svn/trunk svn/tags/\$APP_VERSION:1
237+
"""
238+
sh """
239+
echo "****************Commit to Wordpress******************************"
240+
export APP_VERSION="\$(cat APP_VERSION.tmp)"
241+
echo \$APP_VERSION
242+
svn ci --no-auth-cache --username ${WORDPRESS_USERNAME} --password ${WORDPRESS_PASSWORD} svn -m "tagging version \$APP_VERSION"
213243
"""
214-
//sh """
215-
// echo "****************Commit to Wordpress******************************"
216-
// #svn ci --no-auth-cache --username $WP_USERNAME --password $WP_PASSWORD svn -m "tagging version ${$BUILD_TAG:1}"
217-
//"""
218244
}
219245
}
220246
}

jenkins/php.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ apiVersion: v1
22
kind: Pod
33
metadata:
44
spec:
5-
serviceAccountName: aplazame-appdeployer
6-
serviceAccount: aplazame-appdeployer
5+
serviceAccount: aplazame-frontdeployer
76
securityContext:
87
fsGroup: 1000
98
containers:

0 commit comments

Comments
 (0)