From 52a709eed9381ff1888ec3255e122a553b6c8f07 Mon Sep 17 00:00:00 2001 From: Jon Ervine Date: Wed, 3 Mar 2021 20:35:05 +0800 Subject: [PATCH] First build --- Dockerfile | 14 ++++++++++++++ Jenkinsfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..508ce1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM quay.io/repository/ansible/ansible-runner:stable-2.9-devel + +RUN pip3 install -r hvac && \ + pip3 install -r psutil && \ + pip3 install -r pymysql + +VOLUME /runner + +WORKDIR /runner + +ENV HOME=/home/runner + +ENTRYPOINT ["entrypoint"] +CMD ["ansible-runner", "run", "/runner"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..1e305c4 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,38 @@ +podTemplate(yaml: """ +kind: Pod +spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251 + imagePullPolicy: Always + command: + - /busybox/cat + tty: true + volumeMounts: + - name: jenkins-docker-cfg + mountPath: /kaniko/.docker + volumes: + - name: jenkins-docker-cfg + projected: + sources: + - secret: + name: regcred + items: + - key: .dockerconfigjson + path: config.json +""" + ) { + + node(POD_LABEL) { + stage('Build with Kaniko') { + git url: 'ssh://git@git.ervine.org/jonny/ansible-runner.git', credentialsId: 'jenkins-to-git' + container('kaniko') { + sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=false --destination=harbor.ervine.dev/public/x86_64/ansible-runner-extra:2.9' + } + } + stage('Notify gchat') { + hangoutsNotify message: "Ansible Runner with extra modules container has built",token: "A2ET831pVslqXTqAx6ycu573r",threadByJob: false + } + } +} +