Skip to content

Commit 20dae59

Browse files
authored
chores(sdk): update sdk go (#22)
1 parent c6c1cbe commit 20dae59

File tree

10 files changed

+27
-154
lines changed

10 files changed

+27
-154
lines changed

.github/workflows/go.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Build
2+
23
on:
34
pull_request:
45
types: ['opened', 'edited', 'reopened', 'synchronize']
@@ -11,15 +12,15 @@ jobs:
1112
name: Build
1213
runs-on: ubuntu-latest
1314
steps:
14-
- name: Set up Go 1.17
15+
- name: Set up Go 1.20
1516
uses: actions/setup-go@v1
1617
with:
17-
go-version: 1.17
18+
go-version: 1.20
1819
id: go
1920

2021
- uses: actions/checkout@v1
2122

2223
- name: Build
2324
run: |
24-
go get -d -v
25-
go build -v
25+
go get -d -v
26+
go build -v

.github/workflows/main.yaml

+9-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# only serve a purpose to live test
1+
# only serve a purpose to live test
22
name: Deploy
3+
34
on:
45
pull_request:
56
types: ['opened', 'edited', 'reopened', 'synchronize']
@@ -18,9 +19,8 @@ on:
1819

1920
jobs:
2021
deploy-scaleway-container:
21-
2222
runs-on: ubuntu-latest
23-
name: deploy scaleway serverless container
23+
name: deploy scaleway serverless container
2424
steps:
2525
# To use this repository's private action,
2626
# you must check out the repository
@@ -31,7 +31,6 @@ jobs:
3131
run: |
3232
SAFE_GITHUB_HEAD_REF_SLUG_URL=$(echo $GITHUB_HEAD_REF | rev | cut -c-37 | rev)
3333
([[ $GITHUB_REF == 'refs/heads/main' ]] && echo "BRANCH_SLUG=main" || echo "BRANCH_SLUG=$SAFE_GITHUB_HEAD_REF_SLUG_URL") >> $GITHUB_ENV
34-
3534
- uses: hmarr/debug-action@v2
3635

3736
- name: Start deployment
@@ -44,7 +43,7 @@ jobs:
4443
ref: ${{ github.head_ref }}
4544
debug: true
4645

47-
- name: Scaleway Container Deploy action
46+
- name: Scaleway Container Deploy action
4847
id: deploy
4948
uses: ./ # Uses an action in the root directory
5049
with:
@@ -56,7 +55,7 @@ jobs:
5655
scw_dns: containers.philibeaux.fr
5756
root_zone: true
5857

59-
- name: check output
58+
- name: check output
6059
shell: bash
6160
run: |
6261
echo "${{ steps.deploy.outputs.url }}"
@@ -77,7 +76,7 @@ jobs:
7776
env_url: ${{ steps.deploy.outputs.url }}
7877

7978
teardown-scaleway-container:
80-
name: teardown scaleway serverless container
79+
name: teardown scaleway serverless container
8180
needs: deploy-scaleway-container
8281
runs-on: ubuntu-latest
8382
steps:
@@ -90,10 +89,9 @@ jobs:
9089
run: |
9190
SAFE_GITHUB_HEAD_REF_SLUG_URL=$(echo $GITHUB_HEAD_REF | rev | cut -c-37 | rev)
9291
([[ $GITHUB_REF == 'refs/heads/main' ]] && echo "BRANCH_SLUG=main" || echo "BRANCH_SLUG=$SAFE_GITHUB_HEAD_REF_SLUG_URL") >> $GITHUB_ENV
93-
9492
- uses: hmarr/debug-action@v2
9593

96-
- name: Scaleway Container Teardown action
94+
- name: Scaleway Container Teardown action
9795
id: deploy
9896
uses: ./ # Uses an action in the root directory
9997
with:
@@ -105,7 +103,7 @@ jobs:
105103
scw_dns: containers.philibeaux.fr
106104
root_zone: true
107105

108-
- name: check output
106+
- name: check output
109107
shell: bash
110108
run: |
111109
echo "${{ steps.deploy.outputs.url }}"
@@ -120,11 +118,4 @@ jobs:
120118
debug: true
121119
step: delete-env
122120
token: ${{ secrets.GH_TOKEN }}
123-
env: ${{ env.BRANCH_SLUG }}
124-
125-
126-
127-
128-
129-
130-
121+
env: ${{ env.BRANCH_SLUG }}

Dockerfile

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

33
WORKDIR /app
44

action.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ inputs:
4343
description: "List of environnment variables in the form of KEY=VALUE, separated by commas"
4444
required: false
4545
default: ""
46-
scw_secrets:
47-
description: "List of environnment variables in the form of KEY=VALUE, separated by commas. The value can't contains commas nor equal signs"
48-
required: false
49-
default: ""
5046
scw_secrets:
5147
description: "List of secrets in the form of KEY=VALUE, separated by commas. The value can't contains commas nor equal signs"
5248
required: false

async.go

-90
This file was deleted.

dns.go

+7-33
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,21 @@ var (
2424
TTL = uint32(360)
2525
)
2626

27-
func WaitForDNS(
28-
client *scw.Client,
29-
DNSZone string,
30-
) (*domain.DNSZone, error) {
31-
timeout := waitForDNSDefaultTimeout
32-
retryInterval := defaultRetryInterval
27+
func WaitForDNSReady(client *scw.Client, DNSZone string) (*domain.DNSZone, error) {
28+
fmt.Println("waiting for dns zone to be ready")
3329

3430
api := domain.NewAPI(client)
3531

36-
terminalStatus := map[domain.DNSZoneStatus]struct{}{
37-
domain.DNSZoneStatusActive: {},
38-
domain.DNSZoneStatusLocked: {},
39-
domain.DNSZoneStatusError: {},
40-
}
41-
42-
dns, err := WaitSync(&WaitSyncConfig{
43-
Get: func() (interface{}, bool, error) {
44-
// listing dns zones and take the first one
45-
DNSZones, err := api.ListDNSZones(&domain.ListDNSZonesRequest{
46-
DNSZone: DNSZone,
47-
})
48-
49-
if err != nil {
50-
return nil, false, err
51-
}
52-
53-
Dns := DNSZones.DNSZones[0]
54-
55-
_, isTerminal := terminalStatus[Dns.Status]
56-
57-
return Dns, isTerminal, nil
58-
},
59-
Timeout: timeout,
60-
IntervalStrategy: LinearIntervalStrategy(retryInterval),
32+
dns, err := api.WaitForDNSZone(&domain.WaitForDNSZoneRequest{
33+
DNSZone: DNSZone,
6134
})
6235

6336
if err != nil {
64-
return nil, fmt.Errorf("error waiting for DNS zone to be ready: %s", err)
37+
return dns, err
6538
}
6639

67-
return dns.(*domain.DNSZone), nil
40+
return dns, nil
41+
6842
}
6943

7044
func DeleteDNSRecord(

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.9
5+
require github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15
66

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

go.sum

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
12
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
23
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
3-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9 h1:0roa6gXKgyta64uqh52AQG3wzZXH21unn+ltzQSXML0=
4-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
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=
56
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
67
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
78
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func SetupDomain(Client *scw.Client, Container *container.Container) (*container
166166
fmt.Println("unable to set DNS record: ", err)
167167
}
168168

169-
dns, err := WaitForDNS(Client, DNSName)
169+
dns, err := WaitForDNSReady(Client, DNSName)
170170

171171
if err != nil {
172172
fmt.Println(dns)

scaleway-container-deploy-action

7.08 MB
Binary file not shown.

0 commit comments

Comments
 (0)