Skip to content

Commit 828da30

Browse files
akramopenshift-merge-robot
authored andcommitted
Universal redeploy script
1 parent 028d5bd commit 828da30

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

deploy.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
# Deploys locally the plugin in a pod which has label name=jenkins
4+
# You must be correctly logged in an OpenShift or Kubernetes cluster (KUBECONFIG set or oc login)
5+
pod_name=$( oc get pods -l name=jenkins --output=name | cut -f2 -d/)
6+
plugin_path=/var/lib/jenkins/plugins
7+
plugin_name=$( xmllint --xpath "/*[local-name() = 'project']/*[local-name() = 'artifactId']/text()" pom.xml )
8+
plugin_dst_extension=jpi
9+
plugin_src_extension=hpi
10+
plugin_full_path=$plugin_path/$plugin_name.$plugin_dst_extension
11+
12+
local_plugin_path=target/$plugin_name.$plugin_src_extension
13+
remote_plugin_path=$pod_name:$plugin_full_path
14+
remote_plugin_directory=$plugin_path/$plugin_name
15+
16+
echo "Copying $local_plugin_path into $remote_plugin_path"
17+
oc cp $local_plugin_path $remote_plugin_path
18+
echo "Unzipping $plugin_full_path into $remote_plugin_directory"
19+
oc exec $pod_name -- unzip -o $plugin_full_path -d $remote_plugin_directory
20+
echo "Restarting container"
21+
oc exec $pod_name -- kill 1

0 commit comments

Comments
 (0)