stash icon indicating copy to clipboard operation
stash copied to clipboard

Snapshot id cast to integer if it only contains digits

Open clayrisser opened this issue 6 years ago • 3 comments

I am facing a bug where a snapshot id is cast to an integer when it only contains digits.

For example, when I passed in the snapshot id "14106737", it converted it to 1.4106737e+07. You can see I am explicitly passing the snapshot id through the quote directive.

{{ $restore.gitlabSnapshot | quote }}

Template

apiVersion: stash.appscode.com/v1beta1
kind: RestoreSession
metadata:
  name: {{ template "gitlab.fullname" . }}-gitlab
  labels:
    app: {{ template "gitlab.name" . }}-gitlab
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  driver: Restic
  repository:
    name: deployment-{{ template "gitlab.fullname" . }}-gitlab
  rules:
    - snapshots:
        - {{ $restore.gitlabSnapshot | quote }}
  target:
    paths:
      /_data
    ref:
      apiVersion: apps/v1
      kind: Deployment
      name: {{ template "gitlab.fullname" . }}-gitlab
    volumeMounts:
      - name: data
        mountPath: /_data

Generated resource

Name:         gitlab-gitlab-gitlab
Namespace:    gitlab
Labels:       app=gitlab-gitlab
              chart=gitlab-0.3.0
              heritage=Tiller
              io.cattle.field/appId=gitlab
              release=gitlab
Annotations:  <none>
API Version:  stash.appscode.com/v1beta1
Kind:         RestoreSession
Metadata:
  Creation Timestamp:  2019-10-07T12:10:13Z
  Finalizers:
    stash.appscode.com
  Generation:        1
  Resource Version:  7961408
  Self Link:         /apis/stash.appscode.com/v1beta1/namespaces/gitlab/restoresessions/gitlab-gitlab-gitlab
  UID:               6a71e4ad-e8fb-11e9-ad89-0659a45f956a
Spec:
  Driver:  Restic
  Repository:
    Name:  deployment-gitlab-gitlab-gitlab
  Rules:
    Snapshots:
      1.4106737e+07
  Target:
    Paths:  /_data
    Ref:
      API Version:  apps/v1
      Kind:         Deployment
      Name:         gitlab-gitlab-gitlab
    Volume Mounts:
      Mount Path:  /_data
      Name:        data
Status:
  Phase:  Failed
  Stats:
    Error:      exit status 1, reason: invalid id "1.4106737e+07": no matching ID found
    Hostname:   host-0
    Phase:      Failed
  Total Hosts:  1
Events:
  Type     Reason                         Age   From                       Message
  ----     ------                         ----  ----                       -------
  Normal   RestoreJobCreated              3m6s  RestoreSession Controller  restore job has been created succesfully for RestoreSession gitlab/gitlab-gitlab-gitlab
  Warning  FailedHostRestore              11s   Restore Init-Container     Failed to restore for host "host-0". Reason: exit status 1, reason: invalid id "1.4106737e+07": no matching ID found
  Warning  RestoreSessionFailedToExecute  11s   RestoreSession Controller  restore failed for host: host-0. Reason: exit status 1, reason: invalid id "1.4106737e+07": no matching ID found

clayrisser avatar Oct 07 '19 12:10 clayrisser

@hossainemruz has anyone been able to reproduce this issue?

clayrisser avatar Dec 03 '19 03:12 clayrisser

@codejamninja we didn't get chance to reproduce this issue.

hossainemruz avatar Dec 03 '19 03:12 hossainemruz

Ok

clayrisser avatar Dec 03 '19 03:12 clayrisser