Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
demo-infra-jenkins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
demo
demo-infra-jenkins
Commits
bcdef58e
Commit
bcdef58e
authored
Apr 17, 2020
by
João Lino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove secrets and make a smarter startup script.
parent
692c2a2b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
26 deletions
+32
-26
demo-infra-jenkins-install.sh
demo-infra-jenkins-install.sh
+30
-11
templates/jenkins-credentials.yaml
templates/jenkins-credentials.yaml
+0
-6
templates/jenkins-secrets.yaml
templates/jenkins-secrets.yaml
+0
-7
values.yaml
values.yaml
+2
-2
No files found.
demo-infra-jenkins-install.sh
View file @
bcdef58e
#!/bin/sh
__is_pod_ready
()
{
POD_STATUS
=
"False"
while
[
"
$POD_STATUS
"
!=
"True"
]
;
do
...
...
@@ -11,16 +10,36 @@ __is_pod_ready() {
done
}
# install jenkins
helm
install
-f
values.yaml
--namespace
demo-infra
--kubeconfig
~/.kube/config demo-infra-jenkins stable/jenkins
__expose_pod
()
{
# kill any previous proxy
kill
$(
ps aux |
grep
'8180[:]8080'
|
awk
'{print $2}'
)
# print admin password
export
JENKINS_PASS
=
$(
kubectl get secret
--namespace
demo-infra demo-infra-jenkins
-o
jsonpath
=
"{.data.jenkins-admin-password}"
|
base64
--decode
)
echo
"HOST: http://192.168.1.194:8180 USERNAME: admin PASSWORD:
$JENKINS_PASS
"
# expose
export
POD_NAME
=
$(
kubectl get pods
--namespace
demo-infra
-l
"app.kubernetes.io/component=jenkins-master"
-l
"app.kubernetes.io/instance=demo-infra-jenkins"
-o
jsonpath
=
"{.items[0].metadata.name}"
)
kubectl
--namespace
demo-infra port-forward
$POD_NAME
8180:8080
--address
0.0.0.0 &
}
POD_STATUS
=
$(
kubectl get pods
--namespace
demo-infra
-l
"app.kubernetes.io/component=jenkins-master"
-l
"app.kubernetes.io/instance=demo-infra-jenkins"
-o
jsonpath
=
'{..status.conditions[?(@.type=="Ready")].status}'
)
if
[
"
$POD_STATUS
"
=
'True'
]
;
then
echo
"pod already installed, exposing it..."
# create proxy into the pod
__expose_pod
else
echo
"pod missing, installing it..."
# install nexus
helm
install
-f
values.yaml
--namespace
demo-infra
--kubeconfig
~/.kube/config demo-infra-jenkins ./
# wait for it to become ready
__is_pod_ready
# wait for it to become ready
__is_pod_ready
# print admin password
export
JENKINS_PASS
=
$(
kubectl get secret
--namespace
demo-infra demo-infra-jenkins
-o
jsonpath
=
"{.data.jenkins-admin-password}"
|
base64
--decode
)
echo
"HOST: http://192.168.1.194:8180 USERNAME: admin PASSWORD:
$JENKINS_PASS
"
# create proxy into the pod
__expose_pod
# expose
export
POD_NAME
=
$(
kubectl get pods
--namespace
demo-infra
-l
"app.kubernetes.io/component=jenkins-master"
-l
"app.kubernetes.io/instance=demo-infra-jenkins"
-o
jsonpath
=
"{.items[0].metadata.name}"
)
kubectl
--namespace
demo-infra port-forward
$POD_NAME
8180:8080
--address
0.0.0.0 &
fi
templates/jenkins-credentials.yaml
deleted
100644 → 0
View file @
692c2a2b
apiVersion
:
v1
kind
:
Secret
metadata
:
name
:
jenkins-credentials
data
:
credentials.xml
:
PD94bWwgdmVyc2lvbj0nMS4xJyBlbmNvZGluZz0nVVRGLTgnPz4KPGNvbS5jbG91ZGJlZXMucGx1Z2lucy5jcmVkZW50aWFscy5TeXN0ZW1DcmVkZW50aWFsc1Byb3ZpZGVyIHBsdWdpbj0iY3Jl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vZW50cnk+CiAgPC9kb21haW5DcmVkZW50aWFsc01hcD4KPC9jb20uY2xvdWRiZWVzLnBsdWdpbnMuY3JlZGVudGlhbHMuU3lzdGVtQ3JlZGVudGlhbHNQcm92aWRlcj4=
\ No newline at end of file
templates/jenkins-secrets.yaml
deleted
100644 → 0
View file @
692c2a2b
apiVersion
:
v1
kind
:
Secret
metadata
:
name
:
jenkins-secrets
data
:
master.key
:
YTdhMjQyMTZiMWUxZTdjMDNkNDhiMGEyYmI2OWFhYjMzNDcyNjlmZmUzYWU0MjYwZjhmMTY5ZTZkMjFjNjhiMWVmMmVlYjhhMjAxNGUyN2U0ZjExNDMxY2IwNDA1ZTQ3NjFhNmJmNjg3YTVhNDRlNjU2YTdkYTQ5ZTk5Y2E4NjlhMzZhZjIxMjE4NmMzNGY5NDEzOWZjODQ2NTU5NzkyNTdkY2IxODY2MmFiOTcyMGE4YmQyYmEzN2QyOThiMzU1NGZkNDU4MjFkZDM1ZmQyYTg1Y2U1MzI2OTQ1ZDM0OThmY2IxYjk1YWNlODNhMWRhYmY0ZjI0NTUyNWJhYTUzMg==
hudson.util.Secret
:
+z3+/YnKuRQBoGObj6Dg4MW6Csz/M5Hw2NMmHX1BnOSvSel+cyn7AEtxXBNOiJtkqjEuUm4MHo/BuuQ3aWSeuDAIoHvZWZqIctk8D7/azrkjt0hnAPdnrLAwDX4mhNT3yZAbssx/YzjzIPkHVdgHcGyL9TdBdkrbbyEZZEFBBWuD8C71cLyidfK/571/qtNBO2mLllh9JReL12EKVLZz3fvnlgC/D2IrCvlb4Y9xYvKYw2+FL98cweOBQV57SvN7XkHvSFdaAejsT5UOIkcU8dKBnVyfHM7qxcjXnX+ZyEiX6LuRoKcYKXfD2V4jddd9vsWyBAi+vx/oiiBXbr/W2bxESlEplV2bvdxCkttxl6c=
\ No newline at end of file
values.yaml
View file @
bcdef58e
...
...
@@ -235,11 +235,11 @@ master:
# - |
# print 'adding global pipeline libraries, register properties, bootstrap jobs...'
# Kubernetes secret that contains a 'credentials.xml' for Jenkins
credentialsXmlSecret
:
jenkins-credentials
#
credentialsXmlSecret: jenkins-credentials
# Kubernetes secret that contains files to be put in the Jenkins 'secrets' directory,
# useful to manage encryption keys used for credentials.xml for instance (such as
# master.key and hudson.util.Secret)
secretsFilesSecret
:
jenkins-secrets
#
secretsFilesSecret: jenkins-secrets
# Jenkins XML job configs to provision
jobs
:
# test: |-
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment