Skip to content

Commit b51a5e6

Browse files
authored
feat(sdk): update sdk scaleway (#26)
Signed-off-by: Alexandre Philibeaux <[email protected]>
1 parent 20dae59 commit b51a5e6

File tree

6 files changed

+22
-6
lines changed

6 files changed

+22
-6
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20
1+
FROM golang:1.22
22

33
WORKDIR /app
44

action.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ inputs:
2929
description: "Memory limit in MB ( 128 | 256 | 512 | 1024 | 2048 )"
3030
required: false
3131
default: "256"
32+
scw_min_scale:
33+
description: "Min Scale of the Container"
34+
required: false
35+
default: "1"
36+
scw_max_scale:
37+
description: "Max Scale of the Container"
38+
required: false
39+
default: "5"
3240
scw_dns:
3341
description: "DNS name where your container will be available. Limitation: 63 char maximun"
3442
required: false
@@ -74,6 +82,8 @@ runs:
7482
- ${{ inputs.scw_registry }}
7583
- ${{ inputs.scw_container_port }}
7684
- ${{ inputs.scw_memory_limit }}
85+
- ${{ inputs.scw_min_scale }}
86+
- ${{ inputs.scw_max_scale }}
7787
- ${{ inputs.scw_dns }}
7888
- ${{ inputs.scw_dns_prefix }}
7989
- ${{ inputs.root_zone }}

container.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,20 @@ func CreateContainerAndDeploy(
196196

197197
port, _ := strconv.ParseInt(envOr(EnvContainerPort, fmt.Sprint(Port)), 10, 32)
198198
memoryLimit, _ := strconv.ParseInt(envOr(EnvMemoryLimit, fmt.Sprint(MemoryLimit)), 10, 32)
199+
minScale, _ := strconv.ParseInt(envOr(EnvMinScale, fmt.Sprint(MinScale)), 10, 32)
200+
maxScale, _ := strconv.ParseInt(envOr(EnvMinScale, fmt.Sprint(MinScale)), 10, 32)
199201

200202
Port := uint32(port)
201203
MemoryLimit := uint32(memoryLimit)
204+
MinScale := uint32(minScale)
205+
MaxScale := uint32(maxScale)
202206

203207
createdContainer, err := api.CreateContainer(&container.CreateContainerRequest{
204208
Description: &Description,
205209
MaxConcurrency: &MaxConcurrency,
206-
MaxScale: &MaxScale,
207210
MemoryLimit: &MemoryLimit,
208211
MinScale: &MinScale,
212+
MaxScale: &MaxScale,
209213
Name: ContainerName,
210214
NamespaceID: NamespaceContainer.ID,
211215
Port: &Port,

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module scaleway-container-deploy-action
22

33
go 1.17
44

5-
require github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15
5+
require github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17
66

77
require gopkg.in/yaml.v2 v2.4.0 // indirect

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
22
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
33
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
4-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15 h1:Y7xOFbD+3jaPw+VN7lkakNJ/pa+ZSQVFp1ONtJaBxns=
5-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
4+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17 h1:1WuWJu7/e8SqK+uQl7lfk/N/oMZTL2NE/TJsNKRNMc4=
5+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
66
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
77
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
88
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ const (
1515
EnvContainerNamespaceID = "INPUT_SCW_CONTAINERS_NAMESPACE_ID"
1616
EnvContainerPort = "INPUT_SCW_CONTAINER_PORT"
1717
EnvDNS = "INPUT_SCW_DNS"
18-
EnvDNSPrefix = "INPUT_SCW_DNS_PREFIX"
18+
EnvDNSPrefix = "INPUT_SCW_DNS_PREFIX"
1919
EnvRegion = "INPUT_SCW_REGION"
2020
EnvPathRegistry = "INPUT_SCW_REGISTRY"
2121
EnvProjectID = "INPUT_SCW_PROJECT_ID"
2222
EnvSecretKey = "INPUT_SCW_SECRET_KEY"
2323
EnvMemoryLimit = "INPUT_SCW_MEMORY_LIMIT"
24+
EnvMinScale = "INPUT_SCW_MIN_SCALE"
25+
EnvMaxScale = "INPUT_SCW_MAX_SCALE"
2426
EnvRootZone = "INPUT_ROOT_ZONE"
2527
EnvEnvironmentVariables = "INPUT_SCW_ENVIRONMENT_VARIABLES"
2628
EnvSecrets = "INPUT_SCW_SECRETS"

0 commit comments

Comments
 (0)