Skip to content

Commit

Permalink
Merge pull request #606 from CS-SI/bug/docker
Browse files Browse the repository at this point in the history
Bugfix: docker
  • Loading branch information
oscarpicas authored Jan 27, 2023
2 parents d8fc191 + cd5e466 commit fc763dd
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 11 deletions.
15 changes: 14 additions & 1 deletion lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ ifneq ($(OS),Windows_NT)
PATH = $(HOME)/.local/bin:$(shell printenv PATH)
endif

VERSIONFILE := version.go
REV := `git rev-parse HEAD 2>/dev/null || echo ""`

all: lib/protocol lib/system lib/utils lib/backend lib/client sdk

vet:
Expand All @@ -31,12 +34,22 @@ test:
bashtest:
@(cd system && $(MAKE) $(@))

gensrc:
genver:
@$(RM) $(VERSIONFILE) || true
@echo "package lib" > $(VERSIONFILE)
@echo "// Build constants" >> $(VERSIONFILE)
@echo "const (" >> $(VERSIONFILE)
@echo " Revision = \"$(REV)\"" >> $(VERSIONFILE)
@echo ")" >> $(VERSIONFILE)
@gofmt $(VERSIONFILE) > /dev/null 2>&1

gensrc: genver
@(mkdir -p mocks) || true
@(cd backend/iaas/userdata && $(MAKE) $(@))
@(cd system && $(MAKE) $(@))

generate: gensrc sdk
@gofmt $(VERSIONFILE) > /dev/null 2>&1
@(cd protocol && $(MAKE) $@)
@(cd utils && $(MAKE) $@)
@(cd backend && $(MAKE) $@)
Expand Down
2 changes: 2 additions & 0 deletions lib/backend/iaas/stacks/huaweicloud/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"encoding/base64"
"fmt"
"github.com/CS-SI/SafeScale/v22/lib"
"net"
"net/http"
"regexp"
Expand Down Expand Up @@ -534,6 +535,7 @@ func (s stack) CreateHost(ctx context.Context, request abstract.HostRequest, ext
metadata["Image"] = request.ImageRef
metadata["Template"] = request.TemplateID
metadata["CreationDate"] = time.Now().Format(time.RFC3339)
metadata["Revision"] = lib.Revision

// defines creation options
srvOpts := serverCreateOpts{
Expand Down
2 changes: 2 additions & 0 deletions lib/backend/iaas/stacks/openstack/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package openstack
import (
"context"
"encoding/json"
"github.com/CS-SI/SafeScale/v22/lib"
"strings"
"time"

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

srvOpts := servers.CreateOpts{
Name: name,
Expand Down
2 changes: 2 additions & 0 deletions lib/backend/iaas/stacks/outscale/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package outscale

import (
"context"
"github.com/CS-SI/SafeScale/v22/lib"

"github.com/CS-SI/SafeScale/v22/lib/backend/resources/abstract"
"github.com/CS-SI/SafeScale/v22/lib/backend/resources/enums/volumespeed"
Expand Down Expand Up @@ -220,6 +221,7 @@ func (s stack) ListVolumes(ctx context.Context) (_ []*abstract.Volume, ferr fail
volume.Tags["CreationDate"] = getResourceTag(ov.Tags, "CreationDate", "")
volume.Tags["ManagedBy"] = getResourceTag(ov.Tags, "ManagedBy", "")
volume.Tags["DeclaredInBucket"] = getResourceTag(ov.Tags, "DeclaredInBucket", "")
volume.Tags["Revision"] = lib.Revision
volumes = append(volumes, volume)
}
return volumes, nil
Expand Down
2 changes: 2 additions & 0 deletions lib/backend/resources/abstract/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package abstract
import (
stdjson "encoding/json"
"fmt"
"github.com/CS-SI/SafeScale/v22/lib"
"time"

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

Expand Down
2 changes: 2 additions & 0 deletions lib/backend/resources/abstract/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package abstract
import (
stdjson "encoding/json"
"fmt"
"github.com/CS-SI/SafeScale/v22/lib"
"math"
"time"

Expand Down Expand Up @@ -248,6 +249,7 @@ func NewHostCore() *HostCore {
hc.ProvisioningState = hoststate.Unknown
hc.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
hc.Tags["ManagedBy"] = "safescale"
hc.Tags["Revision"] = lib.Revision
return hc
}

Expand Down
2 changes: 2 additions & 0 deletions lib/backend/resources/abstract/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package abstract
import (
"encoding/json"
"fmt"
"github.com/CS-SI/SafeScale/v22/lib"
"time"

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

Expand Down
2 changes: 2 additions & 0 deletions lib/backend/resources/abstract/publicip.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package abstract
import (
"encoding/json"
"fmt"
"github.com/CS-SI/SafeScale/v22/lib"
"time"

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

Expand Down
2 changes: 2 additions & 0 deletions lib/backend/resources/abstract/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package abstract
import (
"encoding/json"
"fmt"
"github.com/CS-SI/SafeScale/v22/lib"
"time"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -73,6 +74,7 @@ func NewSubnet() *Subnet {
}
sn.Tags["CreationDate"] = time.Now().Format(time.RFC3339)
sn.Tags["ManagedBy"] = "safescale"
sn.Tags["Revision"] = lib.Revision
return sn
}

Expand Down
2 changes: 2 additions & 0 deletions lib/backend/resources/abstract/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package abstract
import (
"encoding/json"
"fmt"
"github.com/CS-SI/SafeScale/v22/lib"
"time"

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ case $LINUX_KIND in
ubuntu)
export DEBIAN_FRONTEND=noninteractive
sfApt update
apt-cache showpkg software-properties-common && apt-get install --no-install-recommends -y software-properties-common
apt-cache showpkg python-software-properties && apt-get install --no-install-recommends -y python-software-properties
apt-add-repository --yes --update ppa:ansible/ansible
fApt update
sfApt install -y ansible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ case $LINUX_KIND in
ubuntu)
export DEBIAN_FRONTEND=noninteractive
sfApt update
apt-cache showpkg software-properties-common && apt-get install --no-install-recommends -y software-properties-common
apt-cache showpkg python-software-properties && apt-get install --no-install-recommends -y python-software-properties
apt-add-repository --yes --update ppa:ansible/ansible
fApt update
sfApt install -y ansible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ install_docker() {
debian)
export DEBIAN_FRONTEND=noninteractive
sfRetryEx 14m 4 "sfApt update" || sfFail 192 "error updating"
sfRetryEx 14m 4 "sfApt install -qqy apt-transport-https ca-certificates curl software-properties-common" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx 14m 4 "sfApt install -qqy apt-transport-https ca-certificates curl" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx 14m 4 "(apt-cache show gnupg2 && apt install -qqy gnupg2) || (apt-cache show gnupg && apt install -qqy gnupg)"
sfRetryEx 14m 4 "curl -fsSL https://download.docker.com/linux/$LINUX_KIND/gpg | apt-key add -" || sfFail 194 "error updating gpg keys"
echo "deb [arch=amd64] https://download.docker.com/linux/$LINUX_KIND $(lsb_release -cs) stable" >/etc/apt/sources.list.d/docker.list
Expand All @@ -65,7 +65,7 @@ install_docker() {
ubuntu)
export DEBIAN_FRONTEND=noninteractive
sfRetryEx 14m 4 "sfApt update" || sfFail 192 "error updating"
sfRetryEx 14m 4 "sfApt install -qqy apt-transport-https ca-certificates curl software-properties-common" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx 14m 4 "sfApt install -qqy apt-transport-https ca-certificates curl" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx 14m 4 "curl -fsSL https://download.docker.com/linux/$LINUX_KIND/gpg | apt-key add -" || sfFail 194 "error updating gpg keys"
echo "deb [arch=amd64] https://download.docker.com/linux/$LINUX_KIND $(lsb_release -cs) stable" >/etc/apt/sources.list.d/docker.list
sfRetryEx 14m 4 "sfApt update" || sfFail 192 "error updating"
Expand Down
2 changes: 0 additions & 2 deletions lib/backend/resources/operations/embeddedfeatures/ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ feature:
ubuntu)
export DEBIAN_FRONTEND=noninteractive
sfRetry "sfApt update"
apt-cache showpkg software-properties-common && apt-get install --no-install-recommends -y software-properties-common
apt-cache showpkg python-software-properties && apt-get install --no-install-recommends -y python-software-properties
apt-add-repository --yes --update ppa:ansible/ansible
sfRetry "sfApt update"
sfRetry "sfApt install -y ansible"
Expand Down
4 changes: 2 additions & 2 deletions lib/backend/resources/operations/embeddedfeatures/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ feature:
debian)
export DEBIAN_FRONTEND=noninteractive
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "sfApt update" || sfFail 192 "error updating"
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "sfApt install -qqy apt-transport-https ca-certificates curl software-properties-common" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "sfApt install -qqy apt-transport-https ca-certificates curl" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "(apt-cache show gnupg2 && apt install -qqy gnupg2) || (apt-cache show gnupg && apt install -qqy gnupg)"
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "curl -fsSL https://download.docker.com/linux/$LINUX_KIND/gpg | apt-key add -" || sfFail 194 "error updating gpg keys"
echo "deb [arch=amd64] https://download.docker.com/linux/$LINUX_KIND $(lsb_release -cs) stable" >/etc/apt/sources.list.d/docker.list
Expand All @@ -149,7 +149,7 @@ feature:
ubuntu)
export DEBIAN_FRONTEND=noninteractive
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "sfApt update" || sfFail 192 "error updating"
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "sfApt install -qqy apt-transport-https ca-certificates curl software-properties-common" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "sfApt install -qqy apt-transport-https ca-certificates curl" || sfFail 193 "error installing apt tools (exit code $?)"
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "curl -fsSL https://download.docker.com/linux/$LINUX_KIND/gpg | apt-key add -" || sfFail 194 "error updating gpg keys"
echo "deb [arch=amd64] https://download.docker.com/linux/$LINUX_KIND $(lsb_release -cs) stable" >/etc/apt/sources.list.d/docker.list
sfRetryEx {{ or .reserved_LongTimeout "6m" }} {{ or .reserved_DefaultDelay 10 }} "sfApt update" || sfFail 192 "error updating"
Expand Down

0 comments on commit fc763dd

Please sign in to comment.