mirror of
https://github.com/drone/drone-kaniko.git
synced 2026-06-13 10:31:36 +08:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 648478377d | |||
| 8d244528bc | |||
| 032be851de | |||
| 2a15df4bd0 | |||
| edde153446 | |||
| c32ed28951 | |||
| 83dc0a47c8 | |||
| 2a96f08569 | |||
| 40b88e559f | |||
| 42860e1bf6 | |||
| 261458b664 | |||
| 62904766db | |||
| fdf1104358 | |||
| 39ca5e4471 | |||
| bb4c34c632 | |||
| 97101432f6 | |||
| 08b3a85089 |
-137
@@ -131,141 +131,6 @@ steps:
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: arm
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: golang:1.18
|
||||
commands:
|
||||
- go test ./...
|
||||
- sh scripts/build.sh
|
||||
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: plugins/kaniko
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
daemon_off: false
|
||||
dockerfile: docker/docker/Dockerfile.linux.arm64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: gcr
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: plugins/kaniko-gcr
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
daemon_off: false
|
||||
dockerfile: docker/gcr/Dockerfile.linux.arm64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: ecr
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: plugins/kaniko-ecr
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
daemon_off: false
|
||||
dockerfile: docker/ecr/Dockerfile.linux.arm64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: acr
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: plugins/kaniko-acr
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
daemon_off: false
|
||||
dockerfile: docker/acr/Dockerfile.linux.arm64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: docker-kaniko-v1-8
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: plugins/kaniko
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64-kaniko1.8.1
|
||||
daemon_off: false
|
||||
dockerfile: docker/docker/Dockerfile.linux.arm64.kaniko1.8.1
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: gcr-kaniko-v1-8
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: plugins/kaniko-gcr
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64-kaniko1.8.1
|
||||
daemon_off: false
|
||||
dockerfile: docker/gcr/Dockerfile.linux.arm64.kaniko1.8.1
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
|
||||
- name: ecr-kaniko-v1-8
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: plugins/kaniko-ecr
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64-kaniko1.8.1
|
||||
daemon_off: false
|
||||
dockerfile: docker/ecr/Dockerfile.linux.arm64.kaniko1.8.1
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: notifications-docker
|
||||
|
||||
platform:
|
||||
@@ -328,7 +193,6 @@ trigger:
|
||||
|
||||
depends_on:
|
||||
- default
|
||||
- arm
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
@@ -383,4 +247,3 @@ trigger:
|
||||
|
||||
depends_on:
|
||||
- default
|
||||
- arm
|
||||
|
||||
@@ -2,4 +2,3 @@ release
|
||||
coverage.out
|
||||
vendor
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
@@ -17,7 +17,6 @@ export GO111MODULE=on
|
||||
go build -v -a -tags netgo -o release/linux/amd64/kaniko-docker ./cmd/kaniko-docker
|
||||
go build -v -a -tags netgo -o release/linux/amd64/kaniko-gcr ./cmd/kaniko-gcr
|
||||
go build -v -a -tags netgo -o release/linux/amd64/kaniko-ecr ./cmd/kaniko-ecr
|
||||
go build -v -a -tags netgo -o release/linux/amd64/kaniko-acr ./cmd/kaniko-acr
|
||||
```
|
||||
|
||||
## Docker
|
||||
@@ -29,11 +28,6 @@ docker build \
|
||||
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||
--file docker/docker/Dockerfile.linux.amd64 --tag plugins/kaniko .
|
||||
|
||||
docker build \
|
||||
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||
--file docker/acr/Dockerfile.linux.amd64 --tag plugins/kaniko-acr .
|
||||
|
||||
docker build \
|
||||
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||
|
||||
+32
-99
@@ -2,14 +2,12 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
@@ -28,9 +26,8 @@ const (
|
||||
clientSecretKeyEnv string = "AZURE_CLIENT_SECRET"
|
||||
tenantKeyEnv string = "AZURE_TENANT_ID"
|
||||
certPathEnv string = "AZURE_CLIENT_CERTIFICATE_PATH"
|
||||
dockerConfigPath string = "/kaniko/.docker"
|
||||
dockerConfigPath string = "/kaniko/.docker/config.json"
|
||||
defaultDigestFile string = "/kaniko/digest-file"
|
||||
finalUrl string = "https://portal.azure.com/#view/Microsoft_Azure_ContainerRegistries/TagMetadataBlade/registryId/"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -133,7 +130,7 @@ func main() {
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "client-cert",
|
||||
Usage: "Azure client certificate encoded in base64 format",
|
||||
Usage: "Azure client certificate",
|
||||
EnvVar: "CLIENT_CERTIFICATE",
|
||||
},
|
||||
cli.StringFlag{
|
||||
@@ -141,11 +138,6 @@ func main() {
|
||||
Usage: "Azure Tenant Id",
|
||||
EnvVar: "TENANT_ID",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "subscription-id",
|
||||
Usage: "Azure Subscription Id",
|
||||
EnvVar: "SUBSCRIPTION_ID",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "client-id",
|
||||
Usage: "Azure Client Id",
|
||||
@@ -217,12 +209,11 @@ func run(c *cli.Context) error {
|
||||
registry := c.String("registry")
|
||||
noPush := c.Bool("no-push")
|
||||
|
||||
publicUrl, err := setupAuth(
|
||||
err := createDockerConfig(
|
||||
c.String("tenant-id"),
|
||||
c.String("client-id"),
|
||||
c.String("client-cert"),
|
||||
c.String("client-secret"),
|
||||
c.String("subscription-id"),
|
||||
registry,
|
||||
noPush,
|
||||
)
|
||||
@@ -258,7 +249,7 @@ func run(c *cli.Context) error {
|
||||
Artifact: kaniko.Artifact{
|
||||
Tags: c.StringSlice("tags"),
|
||||
Repo: c.String("repo"),
|
||||
Registry: publicUrl, // this is public url on which the artifact can be seen
|
||||
Registry: c.String("registry"),
|
||||
ArtifactFile: c.String("artifact-file"),
|
||||
RegistryType: artifact.Docker,
|
||||
},
|
||||
@@ -266,45 +257,46 @@ func run(c *cli.Context) error {
|
||||
return plugin.Exec()
|
||||
}
|
||||
|
||||
func setupAuth(tenantId, clientId, cert,
|
||||
clientSecret, subscriptionId, registry string, noPush bool) (string, error) {
|
||||
func createDockerConfig(tenantId, clientId, cert,
|
||||
clientSecret, registry string, noPush bool) error {
|
||||
if registry == "" {
|
||||
return "", fmt.Errorf("registry must be specified")
|
||||
return fmt.Errorf("registry must be specified")
|
||||
}
|
||||
|
||||
if noPush {
|
||||
return "", nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// case of client secret or cert based auth
|
||||
if clientId != "" {
|
||||
// only setup auth when pushing or credentials are defined
|
||||
|
||||
token, publicUrl, err := getACRToken(subscriptionId, tenantId, clientId, clientSecret, cert, registry)
|
||||
token, err := getACRToken(tenantId, clientId, clientSecret, cert, registry)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to fetch ACR Token")
|
||||
return errors.Wrap(err, "failed to fetch ACR Token")
|
||||
}
|
||||
err = docker.CreateDockerCfgFile(username, token, registry, dockerConfigPath)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to create docker config")
|
||||
return errors.Wrap(err, "failed to create docker config")
|
||||
}
|
||||
return publicUrl, nil
|
||||
} else {
|
||||
return "", fmt.Errorf("managed authentication is not supported")
|
||||
return fmt.Errorf("managed authentication is not supported")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func getACRToken(subscriptionId, tenantId, clientId, clientSecret, cert, registry string) (string, string, error) {
|
||||
func getACRToken(tenantId, clientId, clientSecret, cert, registry string) (string, error) {
|
||||
if tenantId == "" {
|
||||
return "", "", fmt.Errorf("tenantId can't be empty for AAD authentication")
|
||||
return "", fmt.Errorf("tenantId can't be empty for AAD authentication")
|
||||
}
|
||||
|
||||
if clientId == "" {
|
||||
return "", "", fmt.Errorf("clientId can't be empty for AAD authentication")
|
||||
return "", fmt.Errorf("clientId can't be empty for AAD authentication")
|
||||
}
|
||||
|
||||
if clientSecret == "" && cert == "" {
|
||||
return "", "", fmt.Errorf("one of client secret or cert should be defined")
|
||||
return "", fmt.Errorf("one of client secert or cert should be defined")
|
||||
}
|
||||
|
||||
// in case of authentication via cert
|
||||
@@ -315,21 +307,13 @@ func getACRToken(subscriptionId, tenantId, clientId, clientSecret, cert, registr
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.Setenv(clientIdEnv, clientId); err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to set env variable client Id")
|
||||
}
|
||||
if err := os.Setenv(clientSecretKeyEnv, clientSecret); err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to set env variable client secret")
|
||||
}
|
||||
if err := os.Setenv(tenantKeyEnv, tenantId); err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to set env variable tenant Id")
|
||||
}
|
||||
if err := os.Setenv(certPathEnv, ACRCertPath); err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to set env variable cert path")
|
||||
}
|
||||
// TODO check for presence of file as well.
|
||||
os.Setenv(clientIdEnv, clientId)
|
||||
os.Setenv(clientSecretKeyEnv, clientSecret)
|
||||
os.Setenv(tenantKeyEnv, tenantId)
|
||||
env, err := azidentity.NewEnvironmentCredential(nil)
|
||||
if err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to get env credentials from azure")
|
||||
return "", errors.Wrap(err, "failed to get env credentials from azure")
|
||||
}
|
||||
|
||||
policy := policy.TokenRequestOptions{
|
||||
@@ -342,20 +326,14 @@ func getACRToken(subscriptionId, tenantId, clientId, clientSecret, cert, registr
|
||||
|
||||
azToken, err := env.GetToken(context.Background(), policy)
|
||||
if err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to fetch access token")
|
||||
}
|
||||
|
||||
publicUrl, err := getPublicUrl(azToken.Token, registry, subscriptionId)
|
||||
if err != nil {
|
||||
// execution should not fail because of this error.
|
||||
fmt.Fprintf(os.Stderr, "failed to get public url with error: %s\n", err)
|
||||
return "", errors.Wrap(err, "failed to fetch access token")
|
||||
}
|
||||
|
||||
ACRToken, err := fetchACRToken(tenantId, azToken.Token, registry)
|
||||
if err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to fetch ACR token")
|
||||
return "", errors.Wrap(err, "failed to fetch ACR token")
|
||||
}
|
||||
return ACRToken, publicUrl, nil
|
||||
return ACRToken, nil
|
||||
}
|
||||
|
||||
func fetchACRToken(tenantId, token, registry string) (string, error) {
|
||||
@@ -388,59 +366,14 @@ func fetchACRToken(tenantId, token, registry string) (string, error) {
|
||||
return "", errors.New("failed to get refresh token from acr")
|
||||
}
|
||||
|
||||
func setupACRCert(cert string) error {
|
||||
decoded, err := base64.StdEncoding.DecodeString(cert)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to base64 decode ACR certificate")
|
||||
}
|
||||
err = ioutil.WriteFile(ACRCertPath, []byte(decoded), 0644)
|
||||
func setupACRCert(jsonKey string) error {
|
||||
err := ioutil.WriteFile(ACRCertPath, []byte(jsonKey), 0644)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to write ACR certificate")
|
||||
}
|
||||
err = os.Setenv(certPathEnv, ACRCertPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("failed to set %s environment variable", certPathEnv))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getPublicUrl(token, registryUrl, subscriptionId string) (string, error) {
|
||||
// for backward compatibilty, if the subscription id is not defined, do not fail step.
|
||||
if len(subscriptionId) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
registry := strings.Split(registryUrl, ".")[0]
|
||||
burl := "https://management.azure.com/subscriptions/" +
|
||||
subscriptionId + "/resources?$filter=resourceType%20eq%20'Microsoft.ContainerRegistry/registries'%20and%20name%20eq%20'" +
|
||||
registry + "'&api-version=2021-04-01&$select=id"
|
||||
|
||||
method := "GET"
|
||||
client := &http.Client{}
|
||||
req, err := http.NewRequest(method, burl, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return "", errors.Wrap(err, "failed to create request for getting container registry setting")
|
||||
}
|
||||
|
||||
req.Header.Add("Authorization", "Bearer "+token)
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return "", errors.Wrap(err, "failed to send request for getting container registry setting")
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
var response strct
|
||||
err = json.NewDecoder(res.Body).Decode(&response)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to send request for getting container registry setting")
|
||||
}
|
||||
return finalUrl + encodeParam(response.Value[0].ID), nil
|
||||
}
|
||||
|
||||
func encodeParam(s string) string {
|
||||
return url.QueryEscape(s)
|
||||
}
|
||||
|
||||
type strct struct {
|
||||
Value []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"value"`
|
||||
}
|
||||
|
||||
@@ -90,11 +90,6 @@ func main() {
|
||||
Usage: "enable auto generation of build tags",
|
||||
EnvVar: "PLUGIN_AUTO_TAG",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "dockerconfig-override",
|
||||
Usage: "enable auto generation of build tags",
|
||||
EnvVar: "PLUGIN_DOCKERCONFIG_OVERRIDE",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "auto-tag-suffix",
|
||||
Usage: "the suffix of auto build tags",
|
||||
@@ -201,11 +196,9 @@ func main() {
|
||||
func run(c *cli.Context) error {
|
||||
username := c.String("username")
|
||||
noPush := c.Bool("no-push")
|
||||
// use the dockerconfig present at the path instead of creating one
|
||||
configOverride := c.Bool("dockerconfig-override")
|
||||
|
||||
// only setup auth when pushing or credentials are defined and docker config override is false
|
||||
if (!noPush || username != "") && !configOverride {
|
||||
// only setup auth when pushing or credentials are defined
|
||||
if !noPush || username != "" {
|
||||
if err := createDockerCfgFile(username, c.String("password"), c.String("registry")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.8.1
|
||||
FROM gcr.io/kaniko-project/executor:arm64-v1.8.1
|
||||
|
||||
ENV HOME /root
|
||||
ENV USER root
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
image: plugins/kaniko-acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
@@ -7,12 +7,7 @@ tags:
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: plugins/kaniko-acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/kaniko-acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.6.0
|
||||
FROM gcr.io/kaniko-project/executor:arm64-v1.6.0
|
||||
|
||||
ENV HOME /root
|
||||
ENV USER root
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.8.1
|
||||
|
||||
ENV KANIKO_VERSION=1.8.1
|
||||
ADD release/linux/arm64/kaniko-docker /kaniko/
|
||||
ENTRYPOINT ["/kaniko/kaniko-docker"]
|
||||
@@ -11,8 +11,3 @@ manifests:
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.8.1
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
|
||||
@@ -11,8 +11,3 @@ manifests:
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.6.0
|
||||
FROM gcr.io/kaniko-project/executor:arm64-v1.6.0
|
||||
|
||||
ENV HOME /root
|
||||
ENV USER root
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.8.1
|
||||
|
||||
ENV KANIKO_VERSION=1.8.1
|
||||
ADD release/linux/arm64/kaniko-ecr /kaniko/
|
||||
ENTRYPOINT ["/kaniko/kaniko-ecr"]
|
||||
@@ -11,8 +11,3 @@ manifests:
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.8.1
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
|
||||
@@ -10,9 +10,4 @@ manifests:
|
||||
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.6.0
|
||||
FROM gcr.io/kaniko-project/executor:arm64-v1.6.0
|
||||
|
||||
ENV HOME /root
|
||||
ENV USER root
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.8.1
|
||||
|
||||
ENV KANIKO_VERSION=1.8.1
|
||||
ADD release/linux/arm64/kaniko-gcr /kaniko/
|
||||
ENTRYPOINT ["/kaniko/kaniko-gcr"]
|
||||
@@ -11,8 +11,3 @@ manifests:
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.8.1
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
@@ -11,8 +11,3 @@ manifests:
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
|
||||
+1
-10
@@ -100,16 +100,7 @@ func TestBuild_AutoTags(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "beta tag push",
|
||||
repoBranch: "master",
|
||||
commitRef: "refs/tags/v1.0.0-beta.1",
|
||||
autoTagSuffix: "",
|
||||
expectedTags: []string{
|
||||
"1.0.0-beta.1",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "tag push with suffix",
|
||||
name: "tag push",
|
||||
repoBranch: "master",
|
||||
commitRef: "refs/tags/v1.0.0",
|
||||
autoTagSuffix: "linux-amd64",
|
||||
|
||||
@@ -26,8 +26,7 @@ func CreateDockerCfgFile(username, password, registry, path string) error {
|
||||
authBytes := []byte(fmt.Sprintf("%s:%s", username, password))
|
||||
encodedString := base64.StdEncoding.EncodeToString(authBytes)
|
||||
jsonBytes := []byte(fmt.Sprintf(`{"auths": {"%s": {"auth": "%s"}}}`, "https://"+registry, encodedString))
|
||||
filePath := path + "/config.json"
|
||||
err = ioutil.WriteFile(filePath, jsonBytes, 0644)
|
||||
err = ioutil.WriteFile(path, jsonBytes, 0644)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to create docker config file")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user