fix: modify documents which missing the container configuration during the deploy phase in Jenkinsfile.

This commit is contained in:
123liubao 2021-12-01 10:30:56 +08:00
parent 5c0fc85059
commit ab62f7bda3
8 changed files with 104 additions and 80 deletions

View File

@ -132,15 +132,17 @@ In this example, all workloads are deployed in `kubesphere-sample-dev`. You must
}
stage('deploy to dev') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/all-in-one/devops-sample.yaml | kubectl apply -f -'
steps {
container ('maven') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
}
}
}

View File

@ -183,36 +183,42 @@ You must create the projects as shown in the table below in advance. Make sure y
}
stage('deploy to dev') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.DEV_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/dev-all-in-one/devops-sample.yaml | kubectl apply -f -'
container('maven') {
withCredentials([
kubeconfigFile(
credentialsId: env.DEV_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/dev-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
stage('deploy to staging') {
steps {
input(id: 'deploy-to-staging', message: 'deploy to staging?')
withCredentials([
kubeconfigFile(
credentialsId: env.TEST_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
container('maven') {
input(id: 'deploy-to-staging', message: 'deploy to staging?')
withCredentials([
kubeconfigFile(
credentialsId: env.TEST_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
stage('deploy to production') {
steps {
input(id: 'deploy-to-production', message: 'deploy to production?')
withCredentials([
kubeconfigFile(
credentialsId: env.PROD_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
container('maven') {
input(id: 'deploy-to-production', message: 'deploy to production?')
withCredentials([
kubeconfigFile(
credentialsId: env.PROD_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}

View File

@ -95,12 +95,14 @@ With the above credentials ready, you can create a pipeline using an example Jen
}
stage ('deploy app') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/deploy.yaml | kubectl apply -f -'
container ('go') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/deploy.yaml | kubectl apply -f -'
}
}
}
}

View File

@ -106,12 +106,14 @@ With the above credentials ready, you can use the user `project-regular` to crea
stage('deploy app to multi cluster') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/multi-cluster-deploy.yaml | kubectl apply -f -'
container('go') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/multi-cluster-deploy.yaml | kubectl apply -f -'
}
}
}
}

View File

@ -132,15 +132,17 @@ kubectl get cm -n kubesphere-devops-system ks-devops-agent -o yaml
}
stage('deploy to dev') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/all-in-one/devops-sample.yaml | kubectl apply -f -'
steps {
container ('maven') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
}
}
}

View File

@ -181,36 +181,42 @@ weight: 11440
}
stage('deploy to dev') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.DEV_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/dev-all-in-one/devops-sample.yaml | kubectl apply -f -'
container('maven') {
withCredentials([
kubeconfigFile(
credentialsId: env.DEV_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/dev-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
stage('deploy to staging') {
steps {
input(id: 'deploy-to-staging', message: 'deploy to staging?')
withCredentials([
kubeconfigFile(
credentialsId: env.TEST_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
container('maven') {
input(id: 'deploy-to-staging', message: 'deploy to staging?')
withCredentials([
kubeconfigFile(
credentialsId: env.TEST_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
stage('deploy to production') {
steps {
input(id: 'deploy-to-production', message: 'deploy to production?')
withCredentials([
kubeconfigFile(
credentialsId: env.PROD_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
container('maven') {
input(id: 'deploy-to-production', message: 'deploy to production?')
withCredentials([
kubeconfigFile(
credentialsId: env.PROD_KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}

View File

@ -96,12 +96,14 @@ weight: 11410
stage ('deploy app') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/deploy.yaml | kubectl apply -f -'
container ('go') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/deploy.yaml | kubectl apply -f -'
}
}
}
}

View File

@ -106,12 +106,14 @@ weight: 11420
stage('deploy app to multi cluster') {
steps {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/multi-cluster-deploy.yaml | kubectl apply -f -'
container('go') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < devops-go-sample/manifest/multi-cluster-deploy.yaml | kubectl apply -f -'
}
}
}
}