Skip to content

Commit

Permalink
ci(jenkins): enable fix-permissions to be executed without running ma…
Browse files Browse the repository at this point in the history
…ke too (#16130)

* ci(jenkins): enable fix-permissions to be executed without running make too

* ci(jenkins): go modules are stored in the HOME path

* ci(jenkins): fix permissions should run only if docker is enabled
  • Loading branch information
v1v authored Feb 11, 2020
1 parent 53de288 commit 96c60d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,16 @@ pipeline {
}
}

def makeTarget(context, target){
def makeTarget(context, target, clean = true){
withGithubNotify(context: "${context}") {
withBeatsEnv(){
sh(label: "Make ${target}", script: """
eval "\$(gvm use ${GO_VERSION} --format=bash)"
make ${target}
""")
if(clean) {
sh(script: 'script/fix_permissions.sh ${HOME}')
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ env-logs:
${DOCKER_COMPOSE} logs -f

fix-permissions:
# Change ownership of all files inside /build folder from root/root to current user/group
docker run -v ${PWD}:/beat alpine:3.4 sh -c "find /beat -user 0 -exec chown -h $(shell id -u):$(shell id -g) {} \;"
sh ${ES_BEATS}/script/fix_permissions.sh "${PWD}"

set_version: ## @packaging VERSION=x.y.z set the version of the beat to x.y.z
${ES_BEATS}/dev-tools/set_version ${VERSION}
Expand Down
11 changes: 11 additions & 0 deletions script/fix_permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set +e
readonly LOCATION="${1?Please define the path where the fix permissions should run from}"

if ! docker version ; then
echo "It requires Docker daemon to be installed and running"
else
set -e
# Change ownership of all files inside the specific folder from root/root to current user/group
docker run -v ${LOCATION}:/beat alpine:3.4 sh -c "find /beat -user 0 -exec chown -h $(id -u):$(id -g) {} \;"
fi

0 comments on commit 96c60d0

Please sign in to comment.