Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Jenkinsfile) collect azcopy publication logs when failing deployment on trusted.ci.jenkins.io #7664

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,29 +86,39 @@ node('docker&&linux') {
*/
if (infra.isTrusted() && env.BRANCH_NAME == null) {
stage('Publish site') {
infra.withFileShareServicePrincipal([
servicePrincipalCredentialsId: 'trustedci_jenkinsio_fileshare_serviceprincipal_writer',
fileShare: 'jenkins-io',
fileShareStorageAccount: 'jenkinsio'
]) {
try {
infra.withFileShareServicePrincipal([
servicePrincipalCredentialsId: 'trustedci_jenkinsio_fileshare_serviceprincipal_writer',
fileShare: 'jenkins-io',
fileShareStorageAccount: 'jenkinsio'
]) {
sh '''
# Don't output sensitive information
set +x

# Synchronize the File Share content
azcopy sync \
--skip-version-check \
--recursive=true\
--delete-destination=true \
--compare-hash=MD5 \
--put-md5 \
--local-hash-storage-mode=HiddenFiles \
./build/_site/ "${FILESHARE_SIGNED_URL}"
dduportal marked this conversation as resolved.
Show resolved Hide resolved

# Retrieve azcopy logs to archive them
cat /home/jenkins/.azcopy/*.log > azcopy.log
'''
archiveArtifacts 'azcopy.log'
dduportal marked this conversation as resolved.
Show resolved Hide resolved
}
} catch (err) {
currentBuild.result = 'FAILURE'
// Only collect azcopy log when the deployment fails, because it is an heavy one
sh '''
# Don't output sensitive information
set +x

# Synchronize the File Share content
azcopy sync \
--skip-version-check \
--recursive=true\
--delete-destination=true \
--compare-hash=MD5 \
--put-md5 \
--local-hash-storage-mode=HiddenFiles \
./build/_site/ "${FILESHARE_SIGNED_URL}"

# Retrieve azcopy logs to archive them
cat /home/jenkins/.azcopy/*.log > azcopy.log
'''
archiveArtifacts 'azcopy.log'
archiveArtifacts 'azcopy.log'
dduportal marked this conversation as resolved.
Show resolved Hide resolved
}
}
stage('Purge cached CSS') {
Expand Down