|
| 1 | +version: 2 |
| 2 | + |
| 3 | +project_name: vcluster |
| 4 | + |
| 5 | +before: |
| 6 | + hooks: |
| 7 | + - 'echo "Building head images for {{ .Env.CI_BRANCH }} branch"' |
| 8 | + |
| 9 | +builds: |
| 10 | + - id: vcluster |
| 11 | + env: |
| 12 | + - CGO_ENABLED=0 |
| 13 | + - GO111MODULE=on |
| 14 | + goos: |
| 15 | + - linux |
| 16 | + goarch: |
| 17 | + - amd64 |
| 18 | + - arm64 |
| 19 | + binary: vcluster |
| 20 | + main: ./cmd/vcluster |
| 21 | + dir: . |
| 22 | + flags: |
| 23 | + - -trimpath |
| 24 | + - -mod |
| 25 | + - vendor |
| 26 | + tags: |
| 27 | + - embed_chart |
| 28 | + ldflags: |
| 29 | + - -s -w |
| 30 | + - -X github.com/loft-sh/vcluster/pkg/telemetry.SyncerVersion={{.Version}} |
| 31 | + - -X github.com/loft-sh/vcluster/pkg/telemetry.telemetryPrivateKey={{ with index .Env "TELEMETRY_PRIVATE_KEY" }}{{ . }}{{ end }} |
| 32 | + |
| 33 | + - id: vcluster-cli |
| 34 | + env: |
| 35 | + - CGO_ENABLED=0 |
| 36 | + - GO111MODULE=on |
| 37 | + goos: |
| 38 | + - linux |
| 39 | + goarch: |
| 40 | + - amd64 |
| 41 | + - arm64 |
| 42 | + binary: vcluster |
| 43 | + main: ./cmd/vclusterctl |
| 44 | + dir: . |
| 45 | + flags: |
| 46 | + - -trimpath |
| 47 | + - -mod |
| 48 | + - vendor |
| 49 | + tags: |
| 50 | + - embed_chart |
| 51 | + ldflags: |
| 52 | + - -s -w |
| 53 | + - -X main.version={{.Version}} |
| 54 | + - -X github.com/loft-sh/vcluster/pkg/telemetry.SyncerVersion={{.Version}} |
| 55 | + - -X github.com/loft-sh/vcluster/pkg/telemetry.telemetryPrivateKey={{ with index .Env "TELEMETRY_PRIVATE_KEY" }}{{ . }}{{ end }} |
| 56 | + |
| 57 | +dockers: |
| 58 | + # --- Vcluster images --- |
| 59 | + - image_templates: |
| 60 | + - "ghcr.io/loft-sh/vcluster-oss:head-amd64" |
| 61 | + use: buildx |
| 62 | + dockerfile: Dockerfile.release |
| 63 | + ids: |
| 64 | + - vcluster |
| 65 | + build_flag_templates: |
| 66 | + - "--platform=linux/amd64" |
| 67 | + - "--label=org.opencontainers.image.created={{.Date}}" |
| 68 | + - "--label=org.opencontainers.image.name={{.ProjectName}}" |
| 69 | + - "--label=org.opencontainers.image.title={{.ProjectName}}" |
| 70 | + - "--label=org.opencontainers.image.revision={{.FullCommit}}" |
| 71 | + - "--label=org.opencontainers.image.version=head" |
| 72 | + extra_files: |
| 73 | + - dist/vcluster_linux_amd64_v1/vcluster |
| 74 | + skip_push: '{{ ne .Env.CI_BRANCH "main" }}' |
| 75 | + |
| 76 | + - image_templates: |
| 77 | + - "ghcr.io/loft-sh/vcluster-oss:head-arm64v8" |
| 78 | + use: buildx |
| 79 | + goarch: arm64 |
| 80 | + dockerfile: Dockerfile.release |
| 81 | + ids: |
| 82 | + - vcluster |
| 83 | + build_flag_templates: |
| 84 | + - "--platform=linux/arm64/v8" |
| 85 | + - "--label=org.opencontainers.image.created={{.Date}}" |
| 86 | + - "--label=org.opencontainers.image.name={{.ProjectName}}" |
| 87 | + - "--label=org.opencontainers.image.title={{.ProjectName}}" |
| 88 | + - "--label=org.opencontainers.image.revision={{.FullCommit}}" |
| 89 | + - "--label=org.opencontainers.image.version=head" |
| 90 | + extra_files: |
| 91 | + - dist/vcluster_linux_arm64_v8.0/vcluster |
| 92 | + skip_push: '{{ ne .Env.CI_BRANCH "main" }}' |
| 93 | + |
| 94 | + # --- Vcluster-cli images --- |
| 95 | + - image_templates: |
| 96 | + - "ghcr.io/loft-sh/vcluster-cli:head-amd64" |
| 97 | + use: buildx |
| 98 | + dockerfile: Dockerfile.cli.release |
| 99 | + ids: |
| 100 | + - vcluster-cli |
| 101 | + build_flag_templates: |
| 102 | + - "--platform=linux/amd64" |
| 103 | + - "--label=org.opencontainers.image.created={{.Date}}" |
| 104 | + - "--label=org.opencontainers.image.name={{.ProjectName}}" |
| 105 | + - "--label=org.opencontainers.image.title={{.ProjectName}}" |
| 106 | + - "--label=org.opencontainers.image.revision={{.FullCommit}}" |
| 107 | + - "--label=org.opencontainers.image.version=head" |
| 108 | + extra_files: |
| 109 | + - dist/vcluster-cli_linux_amd64_v1/vcluster-cli |
| 110 | + skip_push: '{{ ne .Env.CI_BRANCH "main" }}' |
| 111 | + |
| 112 | + - image_templates: |
| 113 | + # Only build head-arm64v8 tag when on main branch |
| 114 | + - "ghcr.io/loft-sh/vcluster-cli:head-arm64v8" |
| 115 | + use: buildx |
| 116 | + goarch: arm64 |
| 117 | + dockerfile: Dockerfile.cli.release |
| 118 | + ids: |
| 119 | + - vcluster-cli |
| 120 | + build_flag_templates: |
| 121 | + - "--platform=linux/arm64/v8" |
| 122 | + - "--label=org.opencontainers.image.created={{.Date}}" |
| 123 | + - "--label=org.opencontainers.image.name={{.ProjectName}}" |
| 124 | + - "--label=org.opencontainers.image.title={{.ProjectName}}" |
| 125 | + - "--label=org.opencontainers.image.revision={{.FullCommit}}" |
| 126 | + - "--label=org.opencontainers.image.version=head" |
| 127 | + extra_files: |
| 128 | + - dist/vcluster-cli_linux_arm64_v8.0/vcluster-cli |
| 129 | + skip_push: '{{ ne .Env.CI_BRANCH "main" }}' |
| 130 | + |
| 131 | +docker_manifests: |
| 132 | + # --- Head multi arch --- |
| 133 | + - name_template: ghcr.io/loft-sh/vcluster-oss:head |
| 134 | + image_templates: |
| 135 | + - ghcr.io/loft-sh/vcluster-oss:head-amd64 |
| 136 | + - ghcr.io/loft-sh/vcluster-oss:head-arm64v8h |
| 137 | + skip_push: '{{ ne .Env.CI_BRANCH "main" }}' |
| 138 | + |
| 139 | + # --- Head multi arch for CLI --- |
| 140 | + - name_template: ghcr.io/loft-sh/vcluster-cli:head |
| 141 | + image_templates: |
| 142 | + - ghcr.io/loft-sh/vcluster-cli:head-amd64 |
| 143 | + - ghcr.io/loft-sh/vcluster-cli:head-arm64v8 |
| 144 | + skip_push: '{{ ne .Env.CI_BRANCH "main" }}' |
| 145 | + |
| 146 | +# Keep release disabled to avoid creating GitHub releases |
| 147 | +release: |
| 148 | + disable: true |
| 149 | + |
| 150 | +docker_signs: |
| 151 | + - cmd: cosign |
| 152 | + env: |
| 153 | + - COSIGN_EXPERIMENTAL=1 |
| 154 | + artifacts: all |
| 155 | + args: |
| 156 | + - "sign" |
| 157 | + - "${artifact}" |
| 158 | + - "--yes" # needed on cosign 2.0.0+ |
0 commit comments