diff options
author | Andrew Grimberg <agrimberg@linuxfoundation.org> | 2017-01-30 12:59:38 -0800 |
---|---|---|
committer | Andrew Grimberg <agrimberg@linuxfoundation.org> | 2017-01-30 13:20:32 -0800 |
commit | ebc710af742601214491c5b2b9a4f6847d235d6c (patch) | |
tree | 49e8acc7c5b170d186ac65d88debe94a4d935b16 /jenkins-scripts/create_jenkins_user.sh | |
parent | dcd560890f549f999e0ebe437dcc180bbc628d0b (diff) |
Initial ci-management upload
* Configure initial jobs and validate Jenkins environment
* Do not hook up packer build jobs at this time
Change-Id: I1818e8680d215318410f6beff5af054db03e7fa1
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
Diffstat (limited to 'jenkins-scripts/create_jenkins_user.sh')
-rwxr-xr-x | jenkins-scripts/create_jenkins_user.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/jenkins-scripts/create_jenkins_user.sh b/jenkins-scripts/create_jenkins_user.sh new file mode 100755 index 000000000..86a5c92d0 --- /dev/null +++ b/jenkins-scripts/create_jenkins_user.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0> +############################################################################## +# Copyright (c) 2016 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## + +####################### +# Create Jenkins User # +####################### + +OS=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') + +useradd -m -s /bin/bash jenkins + +# Check if docker group exists +grep -q docker /etc/group +if [ "$?" == '0' ] +then + # Add jenkins user to docker group + usermod -a -G docker jenkins +fi + +# Check if mock group exists +grep -q mock /etc/group +if [ "$?" == '0' ] +then + # Add jenkins user to mock group so they can build Int/Pack's RPMs + usermod -a -G mock jenkins +fi + +mkdir /home/jenkins/.ssh +mkdir /w +cp -r /home/${OS}/.ssh/authorized_keys /home/jenkins/.ssh/authorized_keys +# Generate ssh key for use by Robot jobs +echo -e 'y\n' | ssh-keygen -N "" -f /home/jenkins/.ssh/id_rsa -t rsa +chown -R jenkins:jenkins /home/jenkins/.ssh /w |