Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit fc763dd

Browse files
authored
Merge pull request #606 from CS-SI/bug/docker
Bugfix: docker
2 parents d8fc191 + cd5e466 commit fc763dd

File tree

15 files changed

+36
-11
lines changed

15 files changed

+36
-11
lines changed

lib/Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ ifneq ($(OS),Windows_NT)
1919
PATH = $(HOME)/.local/bin:$(shell printenv PATH)
2020
endif
2121

22+
VERSIONFILE := version.go
23+
REV := `git rev-parse HEAD 2>/dev/null || echo ""`
24+
2225
all: lib/protocol lib/system lib/utils lib/backend lib/client sdk
2326

2427
vet:
@@ -31,12 +34,22 @@ test:
3134
bashtest:
3235
@(cd system && $(MAKE) $(@))
3336

34-
gensrc:
37+
genver:
38+
@$(RM) $(VERSIONFILE) || true
39+
@echo "package lib" > $(VERSIONFILE)
40+
@echo "// Build constants" >> $(VERSIONFILE)
41+
@echo "const (" >> $(VERSIONFILE)
42+
@echo " Revision = \"$(REV)\"" >> $(VERSIONFILE)
43+
@echo ")" >> $(VERSIONFILE)
44+
@gofmt $(VERSIONFILE) > /dev/null 2>&1
45+
46+
gensrc: genver
3547
@(mkdir -p mocks) || true
3648
@(cd backend/iaas/userdata && $(MAKE) $(@))
3749
@(cd system && $(MAKE) $(@))
3850

3951
generate: gensrc sdk
52+
@gofmt $(VERSIONFILE) > /dev/null 2>&1
4053
@(cd protocol && $(MAKE) $@)
4154
@(cd utils && $(MAKE) $@)
4255
@(cd backend && $(MAKE) $@)

lib/backend/iaas/stacks/huaweicloud/compute.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"encoding/base64"
2222
"fmt"
23+
"github.com/CS-SI/SafeScale/v22/lib"
2324
"net"
2425
"net/http"
2526
"regexp"
@@ -534,6 +535,7 @@ func (s stack) CreateHost(ctx context.Context, request abstract.HostRequest, ext
534535
metadata["Image"] = request.ImageRef
535536
metadata["Template"] = request.TemplateID
536537
metadata["CreationDate"] = time.Now().Format(time.RFC3339)
538+
metadata["Revision"] = lib.Revision
537539

538540
// defines creation options
539541
srvOpts := serverCreateOpts{

lib/backend/iaas/stacks/openstack/rpc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package openstack
1919
import (
2020
"context"
2121
"encoding/json"
22+
"github.com/CS-SI/SafeScale/v22/lib"
2223
"strings"
2324
"time"
2425

@@ -270,6 +271,7 @@ func (s stack) rpcCreateServer(ctx context.Context, name string, networks []serv
270271
metadata["Image"] = imageID
271272
metadata["Template"] = templateID
272273
metadata["CreationDate"] = time.Now().Format(time.RFC3339)
274+
metadata["Revision"] = lib.Revision
273275

274276
srvOpts := servers.CreateOpts{
275277
Name: name,

lib/backend/iaas/stacks/outscale/volume.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package outscale
1818

1919
import (
2020
"context"
21+
"github.com/CS-SI/SafeScale/v22/lib"
2122

2223
"github.com/CS-SI/SafeScale/v22/lib/backend/resources/abstract"
2324
"github.com/CS-SI/SafeScale/v22/lib/backend/resources/enums/volumespeed"
@@ -220,6 +221,7 @@ func (s stack) ListVolumes(ctx context.Context) (_ []*abstract.Volume, ferr fail
220221
volume.Tags["CreationDate"] = getResourceTag(ov.Tags, "CreationDate", "")
221222
volume.Tags["ManagedBy"] = getResourceTag(ov.Tags, "ManagedBy", "")
222223
volume.Tags["DeclaredInBucket"] = getResourceTag(ov.Tags, "DeclaredInBucket", "")
224+
volume.Tags["Revision"] = lib.Revision
223225
volumes = append(volumes, volume)
224226
}
225227
return volumes, nil

lib/backend/resources/abstract/cluster.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package abstract
1919
import (
2020
stdjson "encoding/json"
2121
"fmt"
22+
"github.com/CS-SI/SafeScale/v22/lib"
2223
"time"
2324

2425
"github.com/CS-SI/SafeScale/v22/lib/backend/resources/enums/clustercomplexity"
@@ -67,6 +68,7 @@ func NewClusterIdentity() *ClusterIdentity {
6768
}
6869
ci.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
6970
ci.Tags["ManagedBy"] = "safescale"
71+
ci.Tags["Revision"] = lib.Revision
7072
return ci
7173
}
7274

lib/backend/resources/abstract/host.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package abstract
1919
import (
2020
stdjson "encoding/json"
2121
"fmt"
22+
"github.com/CS-SI/SafeScale/v22/lib"
2223
"math"
2324
"time"
2425

@@ -248,6 +249,7 @@ func NewHostCore() *HostCore {
248249
hc.ProvisioningState = hoststate.Unknown
249250
hc.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
250251
hc.Tags["ManagedBy"] = "safescale"
252+
hc.Tags["Revision"] = lib.Revision
251253
return hc
252254
}
253255

lib/backend/resources/abstract/network.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package abstract
1919
import (
2020
"encoding/json"
2121
"fmt"
22+
"github.com/CS-SI/SafeScale/v22/lib"
2223
"time"
2324

2425
"github.com/CS-SI/SafeScale/v22/lib/backend/resources/enums/ipversion"
@@ -68,6 +69,7 @@ func NewNetwork() *Network {
6869
}
6970
nn.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
7071
nn.Tags["ManagedBy"] = "safescale"
72+
nn.Tags["Revision"] = lib.Revision
7173
return nn
7274
}
7375

lib/backend/resources/abstract/publicip.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package abstract
1919
import (
2020
"encoding/json"
2121
"fmt"
22+
"github.com/CS-SI/SafeScale/v22/lib"
2223
"time"
2324

2425
"github.com/CS-SI/SafeScale/v22/lib/backend/resources/enums/ipversion"
@@ -50,6 +51,7 @@ func NewPublicIP() *PublicIP {
5051
}
5152
instance.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
5253
instance.Tags["ManagedBy"] = "safescale"
54+
instance.Tags["Revision"] = lib.Revision
5355
return instance
5456
}
5557

lib/backend/resources/abstract/subnet.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package abstract
1919
import (
2020
"encoding/json"
2121
"fmt"
22+
"github.com/CS-SI/SafeScale/v22/lib"
2223
"time"
2324

2425
"github.com/sirupsen/logrus"
@@ -73,6 +74,7 @@ func NewSubnet() *Subnet {
7374
}
7475
sn.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
7576
sn.Tags["ManagedBy"] = "safescale"
77+
sn.Tags["Revision"] = lib.Revision
7678
return sn
7779
}
7880

lib/backend/resources/abstract/volume.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package abstract
1919
import (
2020
"encoding/json"
2121
"fmt"
22+
"github.com/CS-SI/SafeScale/v22/lib"
2223
"time"
2324

2425
"github.com/CS-SI/SafeScale/v22/lib/backend/resources/enums/volumespeed"
@@ -51,6 +52,7 @@ func NewVolume() *Volume {
5152
}
5253
nv.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
5354
nv.Tags["ManagedBy"] = "safescale"
55+
nv.Tags["Revision"] = lib.Revision
5456
return nv
5557
}
5658

0 commit comments

Comments
 (0)