Skip to content

Commit

Permalink
Change workspace dir for circleci privs
Browse files Browse the repository at this point in the history
* Moved the workspace directory to /tmp so that the container would have needed privs.
  • Loading branch information
disaac committed Oct 3, 2019
1 parent d496172 commit 2f6e7ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ jobs:
command: |
export USER=$(whoami)
go build
mkdir -p /workspace
mv packer-provisioner-serverspec* /workspace/
mkdir -p /tmp/workspace
mv packer-provisioner-serverspec* /tmp/workspace/
- persist_to_workspace:
root: /workspace
root: /tmp/workspace
paths:
- packer-provisioner-serverspec
uat_provisioner:
executor: ruby
steps:
- checkout
- attach_workspace:
at: /workspace
at: /tmp/workspace
- run:
name: Install packer and other deps
command: |
Expand All @@ -55,7 +55,7 @@ jobs:
gpg --batch --verify packer_${PACKER_VERSION}_SHA256SUMS.sig packer_${PACKER_VERSION}_SHA256SUMS
mkdir ~/bin
unzip -d ~/bin packer_${PACKER_VERSION}_linux_amd64.zip
cp -p /workspace/packer-provisioner-serverspec ~/bin/packer-provisioner-serverspec
cp -p /tmp/workspace/packer-provisioner-serverspec ~/bin/packer-provisioner-serverspec
- run:
name: Run UAT tests
command: |
Expand All @@ -65,9 +65,9 @@ jobs:
AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
USER=$(whoami)
if [ -v "${AWS_DEFAULT_REGION}" ] && [ -v "${AWS_ACCESS_KEY_ID}" ] && [ -v "${AWS_SECRET_ACCESS_KEY}" ]; then
packer validate -var version=${CIRCLE_BUILD_NUM} uat-aws.json
packer build -var version=${CIRCLE_BUILD_NUM} uat-aws.json
if [ -n "${AWS_DEFAULT_REGION}" ] && [ -n "${AWS_ACCESS_KEY_ID}" ] && [ -n "${AWS_SECRET_ACCESS_KEY}" ]; then
packer validate -var version=${CIRCLE_BUILD_NUM} uat.json
packer build -var version=${CIRCLE_BUILD_NUM} uat.json
else
echo "Must provide AWS UAT Credentials."
exit 1
Expand Down
4 changes: 4 additions & 0 deletions uat/uat.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"variables": {
"user": "{{env `USER`}}"
},
"builders": [{
"type": "amazon-ebs",
"source_ami": "ami-63b25203",
Expand All @@ -12,6 +15,7 @@
}],
"provisioners": [{
"type": "serverspec",
"user": "{{user `user`}}",
"rake_file": "Rakefile",
"rake_task": "serverspec:all"
}]
Expand Down

0 comments on commit 2f6e7ca

Please sign in to comment.