Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Add jenkins.sh job #2

Merged
merged 1 commit into from
Jun 1, 2016
Merged

Add jenkins.sh job #2

merged 1 commit into from
Jun 1, 2016

Conversation

surminus
Copy link
Contributor

This just creates a zip of the code ready for deployment, and exports a variable which is used by a Jenkins job for triggering deployment.

Related: alphagov/govuk-puppet#4427
Further related: alphagov/govuk-terraform-provisioning#46

set -e
mkdir -p archive/$(date +%s)
mv *.zip archive/$(date +$s)/
/usr/bin/zip rename_email_files_with_request_id.py.zip rename_email_files_with_request_id.py || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for the || exit 1 at the end of the line? Won't the set -e catch that?

export FILE_TO_UPLOAD=rename_email_files_with_request_id.py.zip
mkdir -p archive/$(date +%s)
mv $FILE_TO_UPLOAD archive/$(date +$s)/
/usr/bin/zip $FILE_TO_UPLOAD rename_email_files_with_request_id.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do lines 6 and 7 need to be the other way round? I think it's trying to mv a file that doesn't exist at the moment.

Copy link
Contributor Author

@surminus surminus May 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's meant to be archiving anything that might already exist in there, though the syntax is completely wrong, should probably be *.zip rather than $FILE_TO_UPLOAD on line 6. But actually, if the workspace is wiped after every run then this shouldn't be required at all. Zip will add stuff to an archive, perhaps there's an option to completely overwrite just to be on the safe side.

@surminus
Copy link
Contributor Author

/usr/bin/zip -FS overwrites the file if it's already there.


set -e
export FILE_TO_UPLOAD=rename_email_files_with_request_id.py.zip
/usr/bin/zip -FS $FILE_TO_UPLOAD rename_email_files_with_request_id.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be simpler to delete the zip file and create a new one. -FS has some interesting other features.

This just creates a zip of the code ready for deployment.
@surminus
Copy link
Contributor Author

@deanwilson updated script

@deanwilson
Copy link

Merge away.

@alexmuller alexmuller merged commit 0fea213 into master Jun 1, 2016
@alexmuller alexmuller deleted the add-jenkins-script branch June 1, 2016 14:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants