Skip to content

chore(job): cleanup variable usage #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jobs/instances-snapshot-cleaner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ On Scaleway Console on the following link you can create a new Job Definition: h
> For sensitive data like `SCW_ACCESS_KEY` and `SCW_SECRET_KEY` we recommend to inject them via Secret Manager, [more info here](https://www.scaleway.com/en/docs/serverless/jobs/how-to/reference-secret-in-job/).

- `SCW_DELETE_AFTER_DAYS`: number of days after the snapshots will be deleted
- `SCW_PROJECT_ID`: project you want to clean up
- `SCW_DEFAULT_PROJECT_ID`: project you want to clean up
- `SCW_ZONE`: you need to give the ZONE of your snapshot you want to clean, like `fr-par-2`
- `SCW_ACCESS_KEY`: your access key
- `SCW_SECRET_KEY`: your secret key
Expand Down
4 changes: 2 additions & 2 deletions jobs/instances-snapshot-cleaner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module github.com/scaleway/serverless-examples/jobs/instances-snapshot

go 1.24

require github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32
require github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33

require (
github.com/kr/pretty v0.3.1 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
8 changes: 4 additions & 4 deletions jobs/instances-snapshot-cleaner/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32 h1:4+LP7qmsLSGbmc66m1s5dKRMBwztRppfxFKlYqYte/c=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.32/go.mod h1:kzh+BSAvpoyHHdHBCDhmSWtBc1NbLMZ2lWHqnBoxFks=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33 h1:KhF0WejiUTDbL5X55nXowP7zNopwpowa6qaMAWyIE+0=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.33/go.mod h1:792k1RTU+5JeMXm35/e2Wgp71qPH/DmDoZrRc+EFZDk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
2 changes: 1 addition & 1 deletion jobs/instances-snapshot-cleaner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
envOrgID = "SCW_DEFAULT_ORGANIZATION_ID"
envAccessKey = "SCW_ACCESS_KEY"
envSecretKey = "SCW_SECRET_KEY"
envProjectID = "SCW_PROJECT_ID"
envProjectID = "SCW_DEFAULT_PROJECT_ID"
envZone = "SCW_ZONE"

// envDeleteAfter name of env variable to deleter older images.
Expand Down
2 changes: 1 addition & 1 deletion jobs/instances-snapshot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ On Scaleway Console on the following link you can create a new Job Definition: h
> For sensitive data like `SCW_ACCESS_KEY` and `SCW_SECRET_KEY` we recommend to inject them via Secret Manager, [more info here](https://www.scaleway.com/en/docs/serverless/jobs/how-to/reference-secret-in-job/).

- `INSTANCE_ID`: grab the instance ID you want to create snapshots from
- `INSTANCE_ZONE`: you need to give the ZONE of you instance, like `fr-par-2`
- `SCW_ZONE`: you need to give the ZONE of you instance, like `fr-par-2`
- `SCW_ACCESS_KEY`: your access key
- `SCW_SECRET_KEY`: your secret key
- `SCW_DEFAULT_ORGANIZATION_ID`: your organzation ID
Expand Down
6 changes: 3 additions & 3 deletions jobs/instances-snapshot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const (
envOrgID = "SCW_DEFAULT_ORGANIZATION_ID"
envAccessKey = "SCW_ACCESS_KEY"
envSecretKey = "SCW_SECRET_KEY"
envInstanceZone = "SCW_ZONE"
envInstanceID = "INSTANCE_ID"
envInstanceZone = "INSTANCE_ZONE"
)

func main() {
Expand Down Expand Up @@ -46,8 +46,8 @@ func main() {

func createSnapshots(instanceAPI *instance.API) error {
gotInstance, err := instanceAPI.GetServer(&instance.GetServerRequest{
ServerID: os.Getenv("INSTANCE_ID"),
Zone: scw.Zone(os.Getenv("INSTANCE_ZONE")),
ServerID: os.Getenv(envInstanceID),
Zone: scw.Zone(os.Getenv(envInstanceZone)),
})
if err != nil {
return fmt.Errorf("error while getting instance %w", err)
Expand Down
Loading