Skip to content

Commit

Permalink
Merge pull request #97 from mathianasj/dotnet-core-pipeline
Browse files Browse the repository at this point in the history
.NET Core pipeline
  • Loading branch information
pabrahamsson authored Oct 31, 2019
2 parents 827f23b + 5f4252d commit 8247cf8
Show file tree
Hide file tree
Showing 9 changed files with 675 additions and 0 deletions.
70 changes: 70 additions & 0 deletions basic-dotnet-core/.applier/group_vars/seed-hosts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
sb_application_name: basic-dotnet-core
sb_build_namespace: basic-dotnet-core-build
sb_dev_namespace: basic-dotnet-core-dev
sb_stage_namespace: basic-dotnet-core-stage
sb_prod_namespace: basic-dotnet-core-prod
sb_application_repository_url: "https://github.com/redhat-developer/s2i-dotnetcore-ex.git"
sb_application_repository_ref: master
sb_application_readiness_response: "html"
sb_application_readiness_path: "/"
sb_sa_name: "jenkins"
sb_source_repository_url: "https://github.com/redhat-cop/container-pipelines.git"
sb_source_repository_ref: master
sb_pipeline_script: "Jenkinsfile"

openshift_cluster_content:
- object: projects
content:
- name: "create environments"
file: "{{ inventory_dir }}/../.openshift/projects/projects.yml"
action: create
tags:
- project
- object: builds
content:
- name: "deploy build pipeline to dev"
template: "{{ inventory_dir }}/../.openshift/templates/build.yml"
params_from_vars:
APPLICATION_NAME: "{{ sb_application_name }}"
NAMESPACE: "{{ sb_build_namespace }}"
SOURCE_REPOSITORY_URL: "{{ sb_source_repository_url }}"
SOURCE_REPOSITORY_REF: "{{ sb_source_repository_ref }}"
APPLICATION_SOURCE_REPO: "{{ sb_application_repository_url }}"
APPLICATION_SOURCE_REF: "{{ sb_application_repository_ref }}"
PIPELINE_SCRIPT: "{{ sb_pipeline_script }}"
tags:
- build
- object: deployments
content:
- name: "deploy dev environment"
template: "{{ inventory_dir }}/../.openshift/templates/deployment.yml"
params_from_vars:
APPLICATION_NAME: "{{ sb_application_name }}"
NAMESPACE: "{{ sb_dev_namespace }}"
SA_NAMESPACE: "{{ sb_build_namespace }}"
READINESS_RESPONSE: "{{ sb_application_readiness_response }}"
READINESS_PATH: "{{ sb_application_readiness_path }}"
tags:
- deployment
- name: "deply stage environment"
template: "{{ inventory_dir }}/../.openshift/templates/deployment.yml"
params_from_vars:
APPLICATION_NAME: "{{ sb_application_name }}"
NAMESPACE: "{{ sb_stage_namespace }}"
SA_NAME: "{{ sb_sa_name }}"
SA_NAMESPACE: "{{ sb_build_namespace }}"
READINESS_RESPONSE: "{{ sb_application_readiness_response }}"
READINESS_PATH: "{{ sb_application_readiness_path }}"
tags:
- deployment
- name: "deply prod environment"
template: "{{ inventory_dir }}/../.openshift/templates/deployment.yml"
params_from_vars:
APPLICATION_NAME: "{{ sb_application_name }}"
NAMESPACE: "{{ sb_prod_namespace }}"
SA_NAME: "{{ sb_sa_name }}"
SA_NAMESPACE: "{{ sb_build_namespace }}"
READINESS_RESPONSE: "{{ sb_application_readiness_response }}"
READINESS_PATH: "{{ sb_application_readiness_path }}"
tags:
- deployment
2 changes: 2 additions & 0 deletions basic-dotnet-core/.applier/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[seed-hosts]
localhost ansible_connection=local
1 change: 1 addition & 0 deletions basic-dotnet-core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
galaxy
27 changes: 27 additions & 0 deletions basic-dotnet-core/.openshift/projects/projects.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: List
items:
- kind: ProjectRequest
apiVersion: v1
metadata:
name: basic-dotnet-core-build
creationTimestam: null
displayName: .NET Core App - Build
- kind: ProjectRequest
apiVersion: v1
metadata:
name: basic-dotnet-core-dev
creationTimestam: null
displayName: .NET Core App - Dev
- kind: ProjectRequest
apiVersion: v1
metadata:
name: basic-dotnet-core-stage
creationTimestam: null
displayName: .NET Core Appp - Stage
- kind: ProjectRequest
apiVersion: v1
metadata:
name: basic-dotnet-core-prod
creationTimestam: null
displayName: .NET Core App - Prod
157 changes: 157 additions & 0 deletions basic-dotnet-core/.openshift/templates/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
apiVersion: v1
kind: Template
labels:
template: generic-dotnet-jenkins-pipeline
metadata:
annotations:
description: Application template for .NET Core applications built using a Jenkins Pipeline
iconClass: icon-tomcat
version: 1.2.0
name: generic-dotnet-jenkins-pipeline
objects:
- apiVersion: v1
kind: ImageStream
metadata:
labels:
application: ${APPLICATION_NAME}
name: ${APPLICATION_NAME}
namespace: ${NAMESPACE}
- kind: "BuildConfig"
apiVersion: "v1"
metadata:
labels:
application: ${APPLICATION_NAME}
name: "${APPLICATION_NAME}-pipeline"
namespace: "${NAMESPACE}"
spec:
source:
type: Git
git:
uri: ${SOURCE_REPOSITORY_URL}
ref: ${SOURCE_REPOSITORY_REF}
contextDir: ${CONTEXT_DIR}
triggers:
- type: "GitHub"
github:
secret: ${GITHUB_WEBHOOK_SECRET}
- type: "ConfigChange"
strategy:
type: "JenkinsPipeline"
jenkinsPipelineStrategy:
jenkinsfilePath: ${PIPELINE_SCRIPT}
env:
- name: "APPLICATION_SOURCE_REPO"
value: "${APPLICATION_SOURCE_REPO}"
- name: "APPLICATION_SOURCE_REF"
value: "${APPLICATION_SOURCE_REF}"
- apiVersion: v1
kind: BuildConfig
metadata:
labels:
application: ${APPLICATION_NAME}
name: ${APPLICATION_NAME}
namespace: "${NAMESPACE}"
spec:
output:
to:
kind: ImageStreamTag
name: ${APPLICATION_NAME}:latest
source:
binary: {}
type: Binary
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: ${IMAGE_STREAM_TAG_NAME}
namespace: ${IMAGE_STREAM_NAMESPACE}
type: Source
- kind: ConfigMap
apiVersion: v1
metadata:
name: dotnet-jenkins-slave-22
labels:
role: jenkins-slave
namespace: ${NAMESPACE}
data:
dotnet22: |-
<org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
<inheritFrom></inheritFrom>
<name>dotnet-22</name>
<instanceCap>10</instanceCap>
<idleMinutes>0</idleMinutes>
<label>dotnet-22</label>
<serviceAccount>jenkins</serviceAccount>
<nodeSelector></nodeSelector>
<volumes/>
<containers>
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
<name>jnlp</name>
<image>registry.access.redhat.com/dotnet/dotnet-22-jenkins-slave-rhel7:latest</image>
<privileged>false</privileged>
<alwaysPullImage>true</alwaysPullImage>
<workingDir>/tmp</workingDir>
<command></command>
<args>${computer.jnlpmac} ${computer.name}</args>
<ttyEnabled>false</ttyEnabled>
<resourceRequestCpu></resourceRequestCpu>
<resourceRequestMemory></resourceRequestMemory>
<resourceLimitCpu></resourceLimitCpu>
<resourceLimitMemory></resourceLimitMemory>
<envVars/>
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
</containers>
<envVars/>
<annotations/>
<imagePullSecrets/>
<nodeProperties/>
</org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
parameters:
- description: The name for the application.
name: APPLICATION_NAME
required: true
value: basic-dotnet
- description: The namespace to deploy into
name: NAMESPACE
required: true
- description: Git source URI for application
name: SOURCE_REPOSITORY_URL
required: true
value: https://github.com/redhat-cop/container-pipelines.git
- description: Git branch/tag reference
name: SOURCE_REPOSITORY_REF
value: "master"
- description: Path within Git project to build; empty for root project directory.
name: CONTEXT_DIR
value: basic-dotnet-core
- description: Source code repo for demo app
name: APPLICATION_SOURCE_REPO
required: true
value: https://github.com/redhat-developer/s2i-dotnetcore-ex.git
- description: Source code branch for demo app
name: APPLICATION_SOURCE_REF
value: master
- description: Path within Git project pointing to the pipeline run script
name: PIPELINE_SCRIPT
value: Jenkinsfile
- description: GitHub trigger secret
from: '[a-zA-Z0-9]{8}'
generate: expression
name: GITHUB_WEBHOOK_SECRET
required: true
- description: Generic build trigger secret
from: '[a-zA-Z0-9]{8}'
generate: expression
name: GENERIC_WEBHOOK_SECRET
required: true
- description: Namespace in which the ImageStreams for Red Hat Middleware images are
installed. These ImageStreams are normally installed in the openshift namespace.
You should only need to modify this if you've installed the ImageStreams in a
different namespace/project.
name: IMAGE_STREAM_NAMESPACE
required: true
value: openshift
- description: Image stream tag for the image you'd like to use to build the application
name: IMAGE_STREAM_TAG_NAME
required: true
value: dotnet-runtime:2.2
Loading

0 comments on commit 8247cf8

Please sign in to comment.