feature/test #1
+48
-49
@@ -1,51 +1,50 @@
|
||||
version: v0
|
||||
|
||||
runs:
|
||||
- name: agola go example
|
||||
tasks:
|
||||
- name: build go 1.12
|
||||
runtime:
|
||||
type: pod
|
||||
arch: amd64
|
||||
containers:
|
||||
- image: golang:1.12-stretch
|
||||
steps:
|
||||
- clone:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-sum-{{ md5sum "go.sum" }}
|
||||
- cache-date-
|
||||
## golang image sets GOPATH to /go
|
||||
dest_dir: /go/pkg/mod/cache
|
||||
## This will create a binary called `agola-example-go` under ./bin
|
||||
- run:
|
||||
name: build the program
|
||||
command: go build .
|
||||
## Copy the built binary to the workspace
|
||||
- save_to_workspace:
|
||||
contents:
|
||||
- source_dir: .
|
||||
dest_dir: /bin/
|
||||
paths:
|
||||
- agola-example-go
|
||||
- save_cache:
|
||||
key: cache-sum-{{ md5sum "go.sum" }}
|
||||
contents:
|
||||
- source_dir: /go/pkg/mod/cache
|
||||
- save_cache:
|
||||
key: cache-date-{{ year }}-{{ month }}-{{ day }}
|
||||
contents:
|
||||
- source_dir: /go/pkg/mod/cache
|
||||
- name: run
|
||||
## This task will run the built binary in the parent task and leverages the workspace capabilities
|
||||
runtime:
|
||||
type: pod
|
||||
arch: amd64
|
||||
containers:
|
||||
- image: debian:stretch
|
||||
steps:
|
||||
- restore_workspace:
|
||||
dest_dir: .
|
||||
- run: ./bin/agola-example-go
|
||||
depends:
|
||||
- build go 1.12
|
||||
- name: agola go example
|
||||
tasks:
|
||||
- name: build go 1.12
|
||||
runtime:
|
||||
type: pod
|
||||
arch: amd64
|
||||
containers:
|
||||
- image: golang:1.12-stretch
|
||||
steps:
|
||||
- clone:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-sum-{{ md5sum "go.sum" }}
|
||||
- cache-date-
|
||||
## golang image sets GOPATH to /go
|
||||
dest_dir: /go/pkg/mod/cache
|
||||
- ## This will create a binary called `agola-example-go` under ./bin
|
||||
run:
|
||||
name: build the program
|
||||
command: go build .
|
||||
- ## Copy the built binary to the workspace
|
||||
save_to_workspace:
|
||||
contents:
|
||||
- source_dir: .
|
||||
dest_dir: /bin/
|
||||
paths:
|
||||
- agola-example-go
|
||||
- save_cache:
|
||||
key: cache-sum-{{ md5sum "go.sum" }}
|
||||
contents:
|
||||
- source_dir: /go/pkg/mod/cache
|
||||
- save_cache:
|
||||
key: cache-date-{{ year }}-{{ month }}-{{ day }}
|
||||
contents:
|
||||
- source_dir: /go/pkg/mod/cache
|
||||
- name: run
|
||||
## This task will run the built binary in the parent task and leverages the workspace capabilities
|
||||
runtime:
|
||||
type: pod
|
||||
arch: amd64
|
||||
containers:
|
||||
- image: debian:stretch
|
||||
steps:
|
||||
- restore_workspace:
|
||||
dest_dir: .
|
||||
- run: ./bin/agola-example-go
|
||||
depends:
|
||||
- build go 1.12
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# Agola Go example
|
||||
|
||||
|
||||
stuff
|
||||
|
||||
This is just a simple example to test an agola run that'll build a simple go program using a matrix build (multiple Go versions and optionally multiple architectures)
|
||||
|
||||
It uses the jsonnet config format. There's also a (less powerful) yaml config file (to try it delete the jsonnet config since it takes precedence)
|
||||
|
||||
Reference in New Issue
Block a user