Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
8cf6173a69 | |||
986ab429b7 | |||
6fe0d0677c | |||
5aed38a484 | |||
58f331b9ec | |||
3de2001d7e | |||
0dfa3b350b | |||
9c8a3719ce | |||
4e10b5c543 | |||
b2e9b54245 | |||
6c885ec33c | |||
c6c42c4d08 | |||
aa7036f10f | |||
a663931ce4 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
main
|
||||
ci/ci
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM harbor.server.kjuulh.io/docker-proxy/library/golang:alpine as builder
|
||||
FROM harbor.front.kjuulh.io/docker-proxy/library/golang:alpine as builder
|
||||
|
||||
WORKDIR /src/builder
|
||||
|
||||
@ -6,7 +6,7 @@ COPY ci/. .
|
||||
|
||||
RUN go build -o dist/bust main.go
|
||||
|
||||
FROM harbor.server.kjuulh.io/docker-proxy/library/docker:dind
|
||||
FROM harbor.front.kjuulh.io/docker-proxy/library/docker:dind
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
|
14
README.md
Normal file
14
README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Bust
|
||||
|
||||
Bust is a platform agnostic pipeline. It is built on top of `dagger` and
|
||||
`kjuulh/byg`. The goal of this project is to produce a way to easily extend and
|
||||
interact with a golang pipeline for CI
|
||||
|
||||
## Examples
|
||||
|
||||
see `examples` for example pipelines, thought do note that the project usually
|
||||
needs to be self-contained like the `ci` folder. `Bust` is built with `Bust`
|
||||
after all.
|
||||
|
||||
To run simply `go run example/golang-bin/main.go`, this may require certain
|
||||
setup for docker-hub, or alternate registries.
|
@ -26,7 +26,7 @@ func main() {
|
||||
},
|
||||
BuildPath: "main.go",
|
||||
BinName: "bust",
|
||||
BaseImage: "harbor.server.kjuulh.io/docker-proxy/library/docker:dind",
|
||||
BaseImage: "harbor.front.kjuulh.io/docker-proxy/library/docker:dind",
|
||||
CGOEnabled: true,
|
||||
}).
|
||||
Execute(ctx)
|
||||
|
1
example/rust-bin/.dockerignore
Normal file
1
example/rust-bin/.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
target/
|
1
example/rust-bin/.gitignore
vendored
Normal file
1
example/rust-bin/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
target/
|
7
example/rust-bin/Cargo.lock
generated
Normal file
7
example/rust-bin/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "rust-bin"
|
||||
version = "0.1.0"
|
8
example/rust-bin/Cargo.toml
Normal file
8
example/rust-bin/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "rust-bin"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
34
example/rust-bin/main.go
Normal file
34
example/rust-bin/main.go
Normal file
@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/builder"
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/pipelines"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
|
||||
if err := run(ctx); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
func run(ctx context.Context) error {
|
||||
builder, err := builder.New(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer builder.CleanUp()
|
||||
|
||||
return pipelines.
|
||||
New(builder).
|
||||
WithRustBin(&pipelines.RustBinOpts{
|
||||
DockerImageOpt: &pipelines.DockerImageOpt{
|
||||
ImageName: "rust-bin",
|
||||
},
|
||||
BinName: "rust-bin",
|
||||
}).
|
||||
Execute(ctx)
|
||||
}
|
3
example/rust-bin/src/main.rs
Normal file
3
example/rust-bin/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
@ -10,6 +10,7 @@ func Build() *cobra.Command {
|
||||
}
|
||||
|
||||
cmd.AddCommand(
|
||||
BuildRustBin(),
|
||||
BuildGolangBin(),
|
||||
BuildDocker(),
|
||||
)
|
||||
|
52
pkg/cli/build_rust_bin.go
Normal file
52
pkg/cli/build_rust_bin.go
Normal file
@ -0,0 +1,52 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/builder"
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/pipelines"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func BuildRustBin() *cobra.Command {
|
||||
var (
|
||||
binName string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "rustbin",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := cmd.ParseFlags(args); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
repoName := os.Getenv("DRONE_REPO_NAME")
|
||||
if repoName == "" {
|
||||
return errors.New("could not find DRONE_REPO_NAME")
|
||||
}
|
||||
|
||||
ctx := cmd.Context()
|
||||
|
||||
builder, err := builder.New(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer builder.CleanUp()
|
||||
|
||||
return pipelines.
|
||||
New(builder).
|
||||
WithRustBin(&pipelines.RustBinOpts{
|
||||
DockerImageOpt: &pipelines.DockerImageOpt{
|
||||
ImageName: repoName,
|
||||
},
|
||||
BinName: binName,
|
||||
}).
|
||||
Execute(ctx)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().StringVar(&binName, "bin-name", "", "bin-name is the binary to build, and what will be present in the output folder")
|
||||
|
||||
return cmd
|
||||
}
|
@ -16,6 +16,12 @@ var gobinDefault embed.FS
|
||||
//go:embed templates/docker/*
|
||||
var docker embed.FS
|
||||
|
||||
//go:embed templates/default/*
|
||||
var defaultFs embed.FS
|
||||
|
||||
//go:embed templates/rustbin_default/*
|
||||
var rustbinDefault embed.FS
|
||||
|
||||
func NewInitCmd() *cobra.Command {
|
||||
var (
|
||||
template string
|
||||
@ -40,6 +46,16 @@ func NewInitCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
break
|
||||
case "default":
|
||||
if err := initializeTemplate(&defaultFs, "default", name); err != nil {
|
||||
return err
|
||||
}
|
||||
break
|
||||
case "rustbin_default":
|
||||
if err := initializeTemplate(&rustbinDefault, "rustbin_default", name); err != nil {
|
||||
return err
|
||||
}
|
||||
break
|
||||
default:
|
||||
return errors.New("could not find matching templates, please run [bust template ls] instead")
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var templates = []string{"docker", "gobin_default"}
|
||||
var templates = []string{"docker", "gobin_default", "default", "rustbin_default"}
|
||||
|
||||
func NewLsCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
|
4
pkg/cli/templatecmd/templates/default/.drone.yml
Normal file
4
pkg/cli/templatecmd/templates/default/.drone.yml
Normal file
@ -0,0 +1,4 @@
|
||||
kind: template
|
||||
load: bust_default_template.yaml
|
||||
name: [[.Name]]
|
||||
data: {}
|
5
pkg/cli/templatecmd/templates/rustbin_default/.drone.yml
Normal file
5
pkg/cli/templatecmd/templates/rustbin_default/.drone.yml
Normal file
@ -0,0 +1,5 @@
|
||||
kind: template
|
||||
load: bust_rustbin_default_template.yaml
|
||||
name: [[.Name]]
|
||||
data:
|
||||
binName: default
|
@ -56,7 +56,7 @@ func (p *Pipeline) WithDocker(opts *DockerOpt) *Pipeline {
|
||||
opts.ImageTag = strconv.FormatInt(time.Now().UTC().UnixMilli(), 10)
|
||||
}
|
||||
|
||||
tag := fmt.Sprintf("harbor.server.kjuulh.io/kjuulh/%s:%s", opts.ImageName, opts.ImageTag)
|
||||
tag := fmt.Sprintf("harbor.front.kjuulh.io/kjuulh/%s:%s", opts.ImageName, opts.ImageTag)
|
||||
|
||||
_, err := finalImage.Publish(ctx, tag)
|
||||
return err
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
"time"
|
||||
|
||||
"dagger.io/dagger"
|
||||
"git.front.kjuulh.io/kjuulh/byg"
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/tasks/container"
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/tasks/golang"
|
||||
golangbin "git.front.kjuulh.io/kjuulh/bust/pkg/tasks/golang-bin"
|
||||
"git.front.kjuulh.io/kjuulh/byg"
|
||||
)
|
||||
|
||||
type DockerImageOpt struct {
|
||||
@ -48,7 +48,7 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
var err error
|
||||
c := container.LoadImage(client, "harbor.server.kjuulh.io/docker-proxy/library/golang")
|
||||
c := container.LoadImage(client, "harbor.front.kjuulh.io/docker-proxy/library/golang")
|
||||
c, err = container.MountCurrent(ctx, client, c, "/src")
|
||||
if err != nil {
|
||||
return err
|
||||
@ -80,7 +80,7 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
if opts.BaseImage == "" {
|
||||
opts.BaseImage = "harbor.server.kjuulh.io/docker-proxy/library/alpine"
|
||||
opts.BaseImage = "harbor.front.kjuulh.io/docker-proxy/library/alpine"
|
||||
}
|
||||
|
||||
binpath := "/usr/bin"
|
||||
@ -122,7 +122,7 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
opts.ImageTag = strconv.FormatInt(time.Now().UTC().UnixMilli(), 10)
|
||||
}
|
||||
|
||||
tag := fmt.Sprintf("harbor.server.kjuulh.io/kjuulh/%s:%s", opts.ImageName, opts.ImageTag)
|
||||
tag := fmt.Sprintf("harbor.front.kjuulh.io/kjuulh/%s:%s", opts.ImageName, opts.ImageTag)
|
||||
|
||||
_, err := finalImage.Publish(ctx, tag)
|
||||
return err
|
||||
|
@ -3,8 +3,8 @@ package pipelines
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.front.kjuulh.io/kjuulh/byg"
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/builder"
|
||||
"git.front.kjuulh.io/kjuulh/byg"
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
|
134
pkg/pipelines/rust-bin.go
Normal file
134
pkg/pipelines/rust-bin.go
Normal file
@ -0,0 +1,134 @@
|
||||
package pipelines
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"dagger.io/dagger"
|
||||
"git.front.kjuulh.io/kjuulh/bust/pkg/tasks/container"
|
||||
rustbin "git.front.kjuulh.io/kjuulh/bust/pkg/tasks/rust-bin"
|
||||
"git.front.kjuulh.io/kjuulh/byg"
|
||||
)
|
||||
|
||||
type RustBinOpts struct {
|
||||
*DockerImageOpt
|
||||
BinName string
|
||||
BaseImage string
|
||||
}
|
||||
|
||||
func (p *Pipeline) WithRustBin(opts *RustBinOpts) *Pipeline {
|
||||
log.Printf("building image: %s", opts.ImageName)
|
||||
|
||||
client := p.builder.Dagger
|
||||
ctx := context.Background()
|
||||
|
||||
var (
|
||||
bin dagger.FileID
|
||||
finalImage *dagger.Container
|
||||
)
|
||||
|
||||
pipeline := byg.
|
||||
New().
|
||||
Step(
|
||||
"build rust",
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
var err error
|
||||
c := container.LoadImage(client, "harbor.front.kjuulh.io/docker-proxy/library/rust:buster")
|
||||
c = c.Exec(dagger.ContainerExecOpts{
|
||||
Args: []string{
|
||||
"apt", "update", "-y",
|
||||
},
|
||||
})
|
||||
if _, err := c.ExitCode(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
c = c.Exec(dagger.ContainerExecOpts{
|
||||
Args: []string{
|
||||
"apt", "install", "musl-tools", "-y",
|
||||
},
|
||||
})
|
||||
if _, err := c.ExitCode(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c = c.Exec(dagger.ContainerExecOpts{
|
||||
Args: []string{
|
||||
"rustup",
|
||||
"target",
|
||||
"add",
|
||||
"x86_64-unknown-linux-musl",
|
||||
},
|
||||
})
|
||||
if _, err := c.ExitCode(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err = container.MountCurrent(ctx, client, c, "/src")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c = container.Workdir(c, "/src")
|
||||
|
||||
if bin, err = rustbin.Build(ctx, c, opts.BinName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
},
|
||||
},
|
||||
).
|
||||
Step(
|
||||
"create-production-image",
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
if opts.BaseImage == "" {
|
||||
opts.BaseImage = "harbor.front.kjuulh.io/docker-proxy/library/alpine"
|
||||
}
|
||||
|
||||
binpath := "/usr/bin"
|
||||
usrbin := path.Join(binpath, opts.BinName)
|
||||
c := container.LoadImage(client, opts.BaseImage)
|
||||
c = c.Exec(dagger.ContainerExecOpts{
|
||||
Args: []string{"mkdir", "-p", binpath},
|
||||
})
|
||||
_, err := c.ExitCode(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err = container.MountFileFromLoaded(ctx, c, bin, usrbin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
finalImage = c
|
||||
|
||||
return nil
|
||||
},
|
||||
},
|
||||
).
|
||||
Step(
|
||||
"upload-image",
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
|
||||
if opts.ImageTag == "" {
|
||||
opts.ImageTag = strconv.FormatInt(time.Now().UTC().UnixMilli(), 10)
|
||||
}
|
||||
|
||||
tag := fmt.Sprintf("harbor.front.kjuulh.io/kjuulh/%s:%s", opts.ImageName, opts.ImageTag)
|
||||
|
||||
_, err := finalImage.Publish(ctx, tag)
|
||||
return err
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
p.add(pipeline)
|
||||
|
||||
return p
|
||||
}
|
31
pkg/tasks/rust-bin/build.go
Normal file
31
pkg/tasks/rust-bin/build.go
Normal file
@ -0,0 +1,31 @@
|
||||
package rustbin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"dagger.io/dagger"
|
||||
)
|
||||
|
||||
func Build(ctx context.Context, container *dagger.Container, binName string) (dagger.FileID, error) {
|
||||
log.Printf("building binary: (binName=%s)", binName)
|
||||
c := container.Exec(dagger.ContainerExecOpts{
|
||||
Args: []string{
|
||||
"cargo",
|
||||
"build",
|
||||
"--release",
|
||||
"--target=x86_64-unknown-linux-musl",
|
||||
},
|
||||
})
|
||||
if _, err := c.ExitCode(ctx); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
bin, err := c.File(fmt.Sprintf("target/x86_64-unknown-linux-musl/release/%s", binName)).ID(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return bin, nil
|
||||
}
|
3
renovate.json
Normal file
3
renovate.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||
}
|
40
templates/bust_default_template.yaml
Normal file
40
templates/bust_default_template.yaml
Normal file
@ -0,0 +1,40 @@
|
||||
type: docker
|
||||
kind: pipeline
|
||||
name: "drone-dagger-test"
|
||||
|
||||
steps:
|
||||
- name: "build"
|
||||
image: harbor.front.kjuulh.io/kjuulh/bust:1667250488156
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
environment:
|
||||
DOCKER_BUILDKIT: 1
|
||||
HARBOR_DOCKER_HOST: "harbor.front.kjuulh.io"
|
||||
HARBOR_DOCKER_USERNAME:
|
||||
from_secret: "harbor_docker_username"
|
||||
HARBOR_DOCKER_PASSWORD:
|
||||
from_secret: "harbor_docker_password"
|
||||
commands:
|
||||
- sleep 5
|
||||
- >
|
||||
echo "$${HARBOR_DOCKER_PASSWORD}" | docker login
|
||||
--password-stdin
|
||||
--username="$${HARBOR_DOCKER_USERNAME}"
|
||||
"$${HARBOR_DOCKER_HOST}"
|
||||
- bust build default
|
||||
|
||||
services:
|
||||
- name: docker
|
||||
image: docker:dind
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
|
||||
volumes:
|
||||
- name: dockersock
|
||||
temp: {}
|
||||
|
||||
image_pull_secrets:
|
||||
- dockerconfig
|
@ -4,13 +4,13 @@ name: "drone-dagger-test"
|
||||
|
||||
steps:
|
||||
- name: "build"
|
||||
image: harbor.server.kjuulh.io/kjuulh/bust:1667244085545
|
||||
image: harbor.front.kjuulh.io/kjuulh/bust:1667250488156
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
environment:
|
||||
DOCKER_BUILDKIT: 1
|
||||
HARBOR_DOCKER_HOST: "harbor.server.kjuulh.io"
|
||||
HARBOR_DOCKER_HOST: "harbor.front.kjuulh.io"
|
||||
HARBOR_DOCKER_USERNAME:
|
||||
from_secret: "harbor_docker_username"
|
||||
HARBOR_DOCKER_PASSWORD:
|
||||
|
@ -4,13 +4,13 @@ name: "drone-dagger-test"
|
||||
|
||||
steps:
|
||||
- name: "build"
|
||||
image: harbor.server.kjuulh.io/kjuulh/bust:1667244085545
|
||||
image: harbor.front.kjuulh.io/kjuulh/bust:1667244085545
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
environment:
|
||||
DOCKER_BUILDKIT: 1
|
||||
HARBOR_DOCKER_HOST: "harbor.server.kjuulh.io"
|
||||
HARBOR_DOCKER_HOST: "harbor.front.kjuulh.io"
|
||||
HARBOR_DOCKER_USERNAME:
|
||||
from_secret: "harbor_docker_username"
|
||||
HARBOR_DOCKER_PASSWORD:
|
||||
|
@ -4,13 +4,13 @@ name: "drone-dagger-test"
|
||||
|
||||
steps:
|
||||
- name: "build"
|
||||
image: harbor.server.kjuulh.io/docker-proxy/library/docker:dind
|
||||
image: harbor.front.kjuulh.io/docker-proxy/library/docker:dind
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
environment:
|
||||
DOCKER_BUILDKIT: 1
|
||||
HARBOR_DOCKER_HOST: "harbor.server.kjuulh.io"
|
||||
HARBOR_DOCKER_HOST: "harbor.front.kjuulh.io"
|
||||
HARBOR_DOCKER_USERNAME:
|
||||
from_secret: "harbor_docker_username"
|
||||
HARBOR_DOCKER_PASSWORD:
|
||||
@ -26,8 +26,8 @@ steps:
|
||||
--username="$${HARBOR_DOCKER_USERNAME}"
|
||||
"$${HARBOR_DOCKER_HOST}"
|
||||
- >
|
||||
docker pull harbor.server.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT} ||
|
||||
(docker build -t harbor.server.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT} -f tmp/bust/Dockerfile . && docker push harbor.server.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT})
|
||||
docker pull harbor.front.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT} ||
|
||||
(docker build -t harbor.front.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT} -f tmp/bust/Dockerfile . && docker push harbor.front.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT})
|
||||
- >
|
||||
docker run
|
||||
-e DRONE_REPO_NAME="${DRONE_REPO_NAME}"
|
||||
@ -36,7 +36,7 @@ steps:
|
||||
-e HARBOR_DOCKER_PASSWORD=$${HARBOR_DOCKER_PASSWORD}
|
||||
-v "$PWD/:/src/"
|
||||
-v /var/run/docker.sock:/var/run/docker.sock
|
||||
harbor.server.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT}
|
||||
harbor.front.kjuulh.io/kjuulh/bust-builder:${DRONE_COMMIT}
|
||||
sh -c 'echo "$$HARBOR_DOCKER_PASSWORD" | docker login
|
||||
--password-stdin
|
||||
--username="$$HARBOR_DOCKER_USERNAME"
|
||||
|
34
templates/bust_rustbin_default_template.yaml
Normal file
34
templates/bust_rustbin_default_template.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
type: docker
|
||||
kind: pipeline
|
||||
name: "drone-dagger-test"
|
||||
steps:
|
||||
- name: "build"
|
||||
image: harbor.front.kjuulh.io/kjuulh/bust:1667748107856
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
environment:
|
||||
DOCKER_BUILDKIT: 1
|
||||
HARBOR_DOCKER_HOST: "harbor.front.kjuulh.io"
|
||||
HARBOR_DOCKER_USERNAME:
|
||||
from_secret: "harbor_docker_username"
|
||||
HARBOR_DOCKER_PASSWORD:
|
||||
from_secret: "harbor_docker_password"
|
||||
commands:
|
||||
- sleep 5
|
||||
- >
|
||||
echo "$${HARBOR_DOCKER_PASSWORD}" | docker login --password-stdin --username="$${HARBOR_DOCKER_USERNAME}" "$${HARBOR_DOCKER_HOST}"
|
||||
|
||||
- bust build rustbin --bin-name {{ .input.binName }}
|
||||
services:
|
||||
- name: docker
|
||||
image: docker:dind
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
volumes:
|
||||
- name: dockersock
|
||||
temp: {}
|
||||
image_pull_secrets:
|
||||
- dockerconfig
|
@ -7,8 +7,8 @@ function add_template() {
|
||||
drone template update --namespace "${namespace}" --name "${name}" --data "@${name}"
|
||||
}
|
||||
|
||||
add_template kjuulh bust_default_template.yaml
|
||||
add_template kjuulh bust_docker_template.yaml
|
||||
add_template kjuulh bust_gobin_template.yaml
|
||||
add_template kjuulh bust_gobin_default_template.yaml
|
||||
add_template kjuulh bust_docker_template.yaml
|
||||
|
||||
|
||||
add_template kjuulh bust_rustbin_default_template.yaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user