File: go.yaml.template

package info (click to toggle)
golang-github-containerd-stargz-snapshotter 0.14.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,348 kB
  • sloc: sh: 3,634; python: 534; makefile: 91; ansic: 4
file content (114 lines) | stat: -rw-r--r-- 3,268 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Example golang CI based on https://github.com/argoproj/argo-workflows/blob/7dc6515ce1ef76475ac7bd2a7a3c3cdbe795a13c/examples/ci.yaml

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: ci-example-
spec:
  # entrypoint is the name of the template used as the starting point of the workflow
  entrypoint: ci-example
  arguments:
    parameters:
    - name: revision
      value: 09c3a5e
  # a temporary volume, named workdir, will be used as a working directory
  # for this workflow. This volume is passed around from step to step.
  volumeClaimTemplates:
  - metadata:
      name: workdir
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi

  templates:
  - name: ci-example
    inputs:
      parameters:
      - name: revision
    steps:
    - - name: golangci-lint
        template: golangci-lint-example
        arguments:
          parameters:
          - name: revision
            value: "{{inputs.parameters.revision}}"
    - - name: gosec
        template: gosec-example
    - - name: build
        template: build-golang-example
    # the test step expands into three parallel steps running
    # different operating system images. each mounts the workdir
    # and runs the compiled binary from the build step.
    - - name: test
        template: run-hello
        arguments:
          parameters:
          - name: os-image
            value: "{{item.image}}:{{item.tag}}"
        withItems:
        - { image: 'ghcr.io/stargz-containers/alpine', tag: '3.10.2-${IMAGE_TYPE}' }
        - { image: 'ghcr.io/stargz-containers/ubuntu', tag: '22.04-${IMAGE_TYPE}' }
        - { image: 'ghcr.io/stargz-containers/fedora', tag: '30-${IMAGE_TYPE}' }

  - name: golangci-lint-example
    inputs:
      parameters:
      - name: revision
      artifacts:
      - name: code
        path: /go/src/github.com/golang/example
        git:
          repo: https://github.com/golang/example.git
          revision: "{{inputs.parameters.revision}}"
    container:
      image: ghcr.io/stargz-containers/golangci-lint:v1.40.1-${IMAGE_TYPE}
      command: [sh, -c]
      args: ["
        cd /go/src/github.com/golang/example/hello &&
        golangci-lint run ./...
      "]
      volumeMounts:
      - name: workdir
        mountPath: /go

  - name: gosec-example
    container:
      image: ghcr.io/stargz-containers/gosec:v2.8.0-${IMAGE_TYPE}
      command: [sh, -c]
      args: ["
        cd /go/src/github.com/golang/example/hello &&
        gosec ./...
      "]
      volumeMounts:
      - name: workdir
        mountPath: /go

  - name: build-golang-example
    container:
      image: ghcr.io/stargz-containers/golang:1.15.3-buster-${IMAGE_TYPE}
      command: [sh, -c]
      args: ["
        cd /go/src/github.com/golang/example/hello &&
        go build -v .
      "]
      volumeMounts:
      - name: workdir
        mountPath: /go

  - name: run-hello
    inputs:
      parameters:
      - name: os-image
    container:
      image: "{{inputs.parameters.os-image}}"
      command: [sh, -c]
      args: ["
        uname -a ;
        cat /etc/os-release ;
        /go/src/github.com/golang/example/hello/hello
      "]
      volumeMounts:
      - name: workdir
        mountPath: /go