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

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

Merged
merged 4 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
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}"
mikemadden42 marked this conversation as resolved.
Show resolved Hide resolved

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