Skip to content

Commit

Permalink
Merge pull request #3 from thelamer/master
Browse files Browse the repository at this point in the history
Allow non root users on a build node to delete temp files
  • Loading branch information
j0nnymoe committed Dec 19, 2018
2 parents 39c4f37 + 95d5f4a commit a8af572
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions roles/generate-jenkins/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@
src: ../templates/Jenkinsfile.j2
dest: "/tmp/GENERATED.Jenkinsfile"
delegate_to: localhost

- name: Allow non root host to delete temp files
when:
- lookup('env', 'LOCAL') != "true"
command: chmod -R 777 /ansible/jenkins
delegate_to: localhost
6 changes: 4 additions & 2 deletions roles/generate-jenkins/templates/Jenkinsfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,12 @@ pipeline {
docker run --rm --entrypoint '/bin/sh' -v ${TEMPDIR}:/tmp ${LOCAL_CONTAINER} -c '\
apk info > packages && \
apk info -v > versions && \
paste -d " " packages versions > /tmp/package_versions.txt'
paste -d " " packages versions > /tmp/package_versions.txt && \
chmod 777 /tmp/package_versions.txt'
elif [ "${DIST_IMAGE}" == "ubuntu" ]; then
docker run --rm --entrypoint '/bin/sh' -v ${TEMPDIR}:/tmp ${LOCAL_CONTAINER} -c '\
apt -qq list --installed | awk "{print \$1,\$2}" > /tmp/package_versions.txt'
apt -qq list --installed | awk "{print \$1,\$2}" > /tmp/package_versions.txt && \
chmod 777 /tmp/package_versions.txt'
fi
if [ "$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )" != "${PACKAGE_TAG}" ]; then
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/${LS_REPO}
Expand Down

0 comments on commit a8af572

Please sign in to comment.