Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # generates the .drone.yml file
- # jsonnet -S .drone.jsonnet > .drone.jsonnet.yml
- # return the golang image name for the provided
- # os and architecture.
- local golang(os, arch) =
- if arch == 'arm' then
- 'arm32v7/golang:1.10.3'
- else if arch == 'arm64' then
- 'arm64v8/golang:1.10.3'
- else if os == 'windows' then
- 'golang:1.10.3-windowsservercore-1803'
- else
- 'golang:1.10.3';
- # return the docker plugin image name for the provided
- # os and architecture.
- local docker(os, arch) =
- if arch == 'arm' then
- 'plugins/docker:linux-arm'
- else if arch == 'arm64' then
- 'plugins/docker:linux-arm64'
- else
- 'plugins/docker:latest';
- # return the pipeline configuration for the provided
- # os and architecture.
- local pipeline(os, arch) = {
- metadata: {
- name: os + "-" + arch,
- },
- platform: {
- name: os + "/" + arch,
- },
- pipeline: [
- {
- test: {
- image: golang(os, arch),
- commands: [
- "cd posix",
- "tar -xf fixtures.tar -C /",
- "go test -v"
- ]
- }
- },
- {
- publish: {
- image: docker(os, arch),
- repo: "drone/git",
- dockerfile: "docker/Dockerfile." + os + "." + arch,
- auto_tag: true,
- auto_tag_suffix: os + "-" +arch,
- secrets: [
- "docker_username",
- "docker_password"
- ],
- when: {
- "event": [
- "push",
- "tag"
- ]
- }
- }
- }
- ],
- # secrets sources from the external AWS secrets
- # manager using a secret plugin.
- secrets: {
- docker_username: {
- external: {
- name: "drone/docker#username"
- }
- },
- docker_password: {
- external: {
- name: "drone/docker#password"
- }
- }
- }
- };
- # combine all architectures to create a multi-pipeline
- # build for multiple os and architecture combinations.
- std.manifestYamlStream([
- pipeline("linux", "amd64"),
- pipeline("linux", "arm"),
- pipeline("linux", "arm64"),
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement