Skip to content

Instantly share code, notes, and snippets.

@lance
Last active July 18, 2019 19:09

Revisions

  1. lance revised this gist Jul 18, 2019. 1 changed file with 9 additions and 14 deletions.
    23 changes: 9 additions & 14 deletions deploy-webapp-task.yaml
    Original file line number Diff line number Diff line change
    @@ -5,38 +5,33 @@ metadata:
    spec:
    inputs:
    resources:
    - name: image
    type: image
    - name: source
    type: git
    params:
    - name: SOURCE_PATH
    - name: BUILDER_IMAGE
    description: The location of the s2i builder image
    - name: PATH_CONTEXT
    description: The location of the build output
    default: build
    - name: TLSVERIFY
    description: Verify the TLS on the registry endpoint
    default: "true"
    outputs:
    resources:
    - name: image
    - name: runtimeimage
    type: image
    steps:
    - name: copy-source
    image: ${inputs.resources.image}
    workingdir: /opt/app-root/source
    command: ['cp', '-Rp', '${inputs.params.SOURCE_PATH}', '/gen-source/']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
    - name: generate
    image: quay.io/openshift-pipeline/s2i
    workingdir: /workspace/source
    command: ['s2i', 'build', '/gen-source/${inputs.params.SOURCE_PATH}', 'nginx', '--as-dockerfile', '/gen-source/Dockerfile.gen']
    command: ['s2i', 'build', '${inputs.params.PATH_CONTEXT}', '${inputs.params.BUILDER_IMAGE}', '--as-dockerfile', '/gen-source/Dockerfile.gen']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
    - name: build
    image: quay.io/buildah/stable
    workingdir: /gen-source
    command: ['buildah', 'bud', '--tls-verify=${inputs.params.TLSVERIFY}', '--layers', '-f', '/gen-source/Dockerfile.gen', '-t', '${outputs.resources.image.url}', '.']
    command: ['buildah', 'bud', '--tls-verify=${inputs.params.TLSVERIFY}', '--layers', '-f', '/gen-source/Dockerfile.gen', '-t', '${outputs.resources.runtimeimage.url}', '.']
    volumeMounts:
    - name: varlibcontainers
    mountPath: /var/lib/containers
    @@ -46,7 +41,7 @@ spec:
    privileged: true
    - name: push
    image: quay.io/buildah/stable
    command: ['buildah', 'push', '--tls-verify=${inputs.params.TLSVERIFY}', '${outputs.resources.image.url}', 'docker://${outputs.resources.image.url}']
    command: ['buildah', 'push', '--tls-verify=${inputs.params.TLSVERIFY}', '${outputs.resources.runtimeimage.url}', 'docker://${outputs.resources.runtimeimage.url}']
    volumeMounts:
    - name: varlibcontainers
    mountPath: /var/lib/containers
  2. lance revised this gist Jul 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploy-webapp-task.yaml
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ spec:
    params:
    - name: SOURCE_PATH
    description: The location of the build output
    default: "build"
    default: build
    - name: TLSVERIFY
    description: Verify the TLS on the registry endpoint
    default: "true"
  3. lance revised this gist Jul 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploy-webapp-task.yaml
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ spec:
    params:
    - name: SOURCE_PATH
    description: The location of the build output
    default: build
    default: "build"
    - name: TLSVERIFY
    description: Verify the TLS on the registry endpoint
    default: "true"
  4. lance revised this gist Jul 16, 2019. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions deploy-webapp-task.yaml
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,13 @@ spec:
    resources:
    - name: image
    type: image
    params:
    - name: SOURCE_PATH
    description: The location of the build output
    default: build
    params:
    - name: SOURCE_PATH
    description: The location of the build output
    default: build
    - name: TLSVERIFY
    description: Verify the TLS on the registry endpoint
    default: "true"
    outputs:
    resources:
    - name: image
    @@ -19,14 +22,14 @@ spec:
    - name: copy-source
    image: ${inputs.resources.image}
    workingdir: /opt/app-root/source
    command: ['cp', '-Rp', '${inputs.params.image.SOURCE_PATH}', '/gen-source/']
    command: ['cp', '-Rp', '${inputs.params.SOURCE_PATH}', '/gen-source/']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
    - name: generate
    image: quay.io/openshift-pipeline/s2i
    workingdir: /workspace/source
    command: ['s2i', 'build', '/gen-source/${inputs.params.image.SOURCE_PATH}', 'nginx', '--as-dockerfile', '/gen-source/Dockerfile.gen']
    command: ['s2i', 'build', '/gen-source/${inputs.params.SOURCE_PATH}', 'nginx', '--as-dockerfile', '/gen-source/Dockerfile.gen']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
  5. lance revised this gist Jul 16, 2019. No changes.
  6. lance revised this gist Jul 16, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions deploy-webapp-task.yaml
    Original file line number Diff line number Diff line change
    @@ -19,14 +19,14 @@ spec:
    - name: copy-source
    image: ${inputs.resources.image}
    workingdir: /opt/app-root/source
    command: ['cp', '-Rp', '${inputs.params.SOURCE_PATH}', '/gen-source/']
    command: ['cp', '-Rp', '${inputs.params.image.SOURCE_PATH}', '/gen-source/']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
    - name: generate
    image: quay.io/openshift-pipeline/s2i
    workingdir: /workspace/source
    command: ['s2i', 'build', '/gen-source/${inputs.params.SOURCE_PATH}', 'nginx', '--as-dockerfile', '/gen-source/Dockerfile.gen']
    command: ['s2i', 'build', '/gen-source/${inputs.params.image.SOURCE_PATH}', 'nginx', '--as-dockerfile', '/gen-source/Dockerfile.gen']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
  7. lance created this gist Jul 15, 2019.
    56 changes: 56 additions & 0 deletions deploy-webapp-task.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    apiVersion: tekton.dev/v1alpha1
    kind: Task
    metadata:
    name: deploy-webapp
    spec:
    inputs:
    resources:
    - name: image
    type: image
    params:
    - name: SOURCE_PATH
    description: The location of the build output
    default: build
    outputs:
    resources:
    - name: image
    type: image
    steps:
    - name: copy-source
    image: ${inputs.resources.image}
    workingdir: /opt/app-root/source
    command: ['cp', '-Rp', '${inputs.params.SOURCE_PATH}', '/gen-source/']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
    - name: generate
    image: quay.io/openshift-pipeline/s2i
    workingdir: /workspace/source
    command: ['s2i', 'build', '/gen-source/${inputs.params.SOURCE_PATH}', 'nginx', '--as-dockerfile', '/gen-source/Dockerfile.gen']
    volumeMounts:
    - name: gen-source
    mountPath: /gen-source
    - name: build
    image: quay.io/buildah/stable
    workingdir: /gen-source
    command: ['buildah', 'bud', '--tls-verify=${inputs.params.TLSVERIFY}', '--layers', '-f', '/gen-source/Dockerfile.gen', '-t', '${outputs.resources.image.url}', '.']
    volumeMounts:
    - name: varlibcontainers
    mountPath: /var/lib/containers
    - name: gen-source
    mountPath: /gen-source
    securityContext:
    privileged: true
    - name: push
    image: quay.io/buildah/stable
    command: ['buildah', 'push', '--tls-verify=${inputs.params.TLSVERIFY}', '${outputs.resources.image.url}', 'docker://${outputs.resources.image.url}']
    volumeMounts:
    - name: varlibcontainers
    mountPath: /var/lib/containers
    securityContext:
    privileged: true
    volumes:
    - name: varlibcontainers
    emptyDir: {}
    - name: gen-source
    emptyDir: {}