Skip to content

Commit 498c1a3

Browse files
authored
Merge pull request #524 from kool-dev/kool_cloud_deploy_platform
Add Support to Kool Cloud Deploy to ARM
2 parents 38308f4 + 07bfad3 commit 498c1a3

File tree

7 files changed

+13
-8
lines changed

7 files changed

+13
-8
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
3434
with:
3535
# We must fetch at least the immediate parents so that if this is
3636
# a pull request then we can checkout the head.

.github/workflows/docker-description.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
docker-description:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616

1717
- name: Sync Docker Hub Description
1818
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/kool'

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
with:
1818
go-version: ${{ matrix.go-version }}
1919
- name: Checkout code
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121
- name: Caching
22-
uses: actions/cache@v2
22+
uses: actions/cache@v4
2323
with:
2424
path: ~/go/pkg
2525
key: ${{ runner.os }}-kool-${{ hashFiles('**/go.sum') }}

commands/cloud_deploy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type KoolCloudDeployFlags struct {
2424
Timeout uint // env: KOOL_API_TIMEOUT
2525
WwwRedirect bool // env: KOOL_DEPLOY_WWW_REDIRECT
2626
DeployDomainExtras []string // env: KOOL_DEPLOY_DOMAIN_EXTRAS
27-
27+
Platform string // platform for docker build, e.g. linux/amd64
2828
// Cluster string // env: KOOL_DEPLOY_CLUSTER
2929
}
3030

@@ -53,6 +53,7 @@ func NewDeployCommand(deploy *KoolDeploy) (cmd *cobra.Command) {
5353
cmd.Flags().StringArrayVarP(&deploy.flags.DeployDomainExtras, "domain-extra", "", []string{}, "List of extra domain aliases")
5454
cmd.Flags().BoolVarP(&deploy.flags.WwwRedirect, "www-redirect", "", false, "Redirect www to non-www domain")
5555
cmd.Flags().UintVarP(&deploy.flags.Timeout, "timeout", "", 0, "Timeout in minutes for waiting the deployment to finish")
56+
cmd.Flags().StringVarP(&deploy.flags.Platform, "platform", "", "linux/amd64", "Platform for docker build (default: linux/amd64)")
5657

5758
return
5859
}
@@ -123,7 +124,7 @@ func (d *KoolDeploy) Execute(args []string) (err error) {
123124
if svc.Build != nil {
124125
d.Shell().Info(" > Build deploy image for service '", svcName, "'")
125126

126-
if err = cloud.BuildPushImageForDeploy(svcName, svc, deployCreated); err != nil {
127+
if err = cloud.BuildPushImageForDeploy(svcName, svc, deployCreated, d.flags.Platform); err != nil {
127128
if reportErr := deployer.BuildError(deployCreated, err); reportErr != nil {
128129
d.Shell().Error(fmt.Errorf("error reporting build error: %v", reportErr))
129130
}

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ require github.com/compose-spec/compose-go v1.13.0
3636

3737
require (
3838
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
39+
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
3940
github.com/fatih/color v1.15.0 // indirect
4041
github.com/google/go-github/v30 v30.1.0 // indirect
4142
github.com/google/go-querystring v1.1.0 // indirect
@@ -49,6 +50,7 @@ require (
4950
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
5051
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
5152
github.com/rivo/uniseg v0.4.4 // indirect
53+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
5254
github.com/sirupsen/logrus v1.9.0 // indirect
5355
github.com/spf13/pflag v1.0.5 // indirect
5456
github.com/tcnksm/go-gitconfig v0.1.2 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht
6262
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
6363
github.com/compose-spec/compose-go v1.13.0 h1:HHMc1XvnHJr9LUS7fPiiQeTSmGtEp+myn7jGnXgIoXE=
6464
github.com/compose-spec/compose-go v1.13.0/go.mod h1:uo+YhhqDpkW9MjZNzJgOLX3MlbK6zHaBo9n8LhGDwsg=
65+
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
6566
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
6667
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
6768
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
@@ -221,6 +222,7 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
221222
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
222223
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
223224
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
225+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
224226
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
225227
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
226228
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=

services/cloud/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
yaml "gopkg.in/yaml.v2"
1616
)
1717

18-
func BuildPushImageForDeploy(service string, config *DeployConfigService, deploy *api.DeployCreateResponse) (err error) {
18+
func BuildPushImageForDeploy(service string, config *DeployConfigService, deploy *api.DeployCreateResponse, platform string) (err error) {
1919
if config.Build == nil {
2020
err = errors.New("service " + service + " has no build configuration")
2121
return
@@ -33,7 +33,7 @@ func BuildPushImageForDeploy(service string, config *DeployConfigService, deploy
3333
var in = bytes.NewBuffer([]byte{})
3434
sh.SetInStream(in)
3535

36-
dockerBuild := builder.NewCommand("docker", "build", "-t", image, "--platform", "linux/amd64")
36+
dockerBuild := builder.NewCommand("docker", "build", "-t", image, "--platform", platform)
3737

3838
if folder, isStr := (*config.Build).(string); isStr {
3939
// this should be a simple build with a context folder

0 commit comments

Comments
 (0)