Skip to content

Commit e7b257f

Browse files
committedApr 27, 2023
Add repo sync step to Jenkinsfile
1 parent 946cbb0 commit e7b257f

File tree

1 file changed

+39
-26
lines changed

1 file changed

+39
-26
lines changed
 

‎Jenkinsfile

+39-26
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ pipeline {
1717
// variables for SystemTest stages (integration tests)
1818
STAGING_DIR = "${WORKSPACE}/wit-system-test-files"
1919
DB_IMAGE = "${WKT_OCIR_HOST}/${WKT_TENANCY}/database/enterprise:12.2.0.1-slim"
20-
// GITHUB_API_TOKEN = credentials('encj_github_token')
21-
// GH_TOOL = tool name: 'github-cli', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
2220
}
2321

2422
stages {
@@ -150,37 +148,52 @@ pipeline {
150148
}
151149
stage ('Save Nightly Installer') {
152150
when {
153-
allOf {
154-
triggeredBy 'TimerTrigger'
155-
branch "main"
156-
}
151+
triggeredBy 'TimerTrigger'
152+
branch "main"
157153
}
158154
steps {
159155
sh '''
160156
oci os object put --namespace=${WKT_TENANCY} --bucket-name=wko-system-test-files --config-file=/dev/null --auth=instance_principal --force --file=installer/target/imagetool.zip --name=imagetool-main.zip
161157
'''
162158
}
163159
}
164-
// stage ('Create Draft Release') {
165-
// when {
166-
// tag 'release-*'
167-
// }
168-
// steps {
169-
// script {
170-
// env.TAG_VERSION_NUMBER = env.TAG_NAME.replaceAll('release-','').trim()
171-
// }
172-
//
173-
// sh """
174-
// echo '${env.GITHUB_API_TOKEN}' | ${GH_TOOL}/bin/gh auth login --with-token
175-
// ${GH_TOOL}/bin/gh release create ${TAG_NAME} \
176-
// --draft \
177-
// --generate-notes \
178-
// --title 'WebLogic Image Tool ${TAG_VERSION_NUMBER}' \
179-
// --repo https://github.com/oracle/weblogic-image-tool \
180-
// installer/target/imagetool.zip
181-
// """
182-
// }
183-
// }
160+
stage ('Sync') {
161+
when {
162+
branch 'main'
163+
anyOf {
164+
not { triggeredBy 'TimerTrigger' }
165+
tag 'release-*'
166+
}
167+
}
168+
steps {
169+
build job: "wkt-sync",
170+
parameters: [ string(name: 'REPOSITORY', value: 'weblogic-image-tool') ],
171+
wait: true
172+
}
173+
}
174+
stage ('Create Draft Release') {
175+
when {
176+
tag 'release-*'
177+
}
178+
steps {
179+
script {
180+
env.TAG_VERSION_NUMBER = env.TAG_NAME.replaceAll('release-','').trim()
181+
}
182+
withCredentials([string(credentialsId: 'wkt-github-token', variable: 'GITHUB_API_TOKEN')]) {
183+
sh """
184+
mkdir gh-cli
185+
curl -sL https://github.com/cli/cli/releases/download/v2.28.0/gh_2.28.0_linux_amd64.tar.gz | tar xvzf - --strip-components=1 -C ./gh-cli
186+
echo '${GITHUB_API_TOKEN}' | ./gh-cli/bin/gh auth login --with-token
187+
./gh-cli/bin/gh release create ${TAG_NAME} \
188+
--draft \
189+
--generate-notes \
190+
--title 'WebLogic Image Tool ${TAG_VERSION_NUMBER}' \
191+
--repo https://github.com/oracle/weblogic-image-tool \
192+
installer/target/imagetool.zip
193+
"""
194+
}
195+
}
196+
}
184197
}
185198
}
186199

0 commit comments

Comments
 (0)
Please sign in to comment.