forked from LaconicNetwork/kompose
Adding save command to annotation
This command will add `kompose command` used to generate artifacts as well as `kompose version`,
for ex,
```
metadata:
annotations:
kompose.cmd: kompose convert -f /home/snarwade --stdout
kompose.version: 1.0.0 (HEAD)
```
For functional test, Now each test has template like,
```
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
```
Because, for every machine these values will be different.
Updated functional test with new annotations
This commit is contained in:
@@ -20,15 +20,17 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/kubernetes/kompose/pkg/kobject"
|
||||
|
||||
"github.com/kubernetes/kompose/pkg/utils/docker"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/kubernetes/kompose/pkg/utils/docker"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
)
|
||||
@@ -114,7 +116,14 @@ func ConfigAnnotations(service kobject.ServiceConfig) map[string]string {
|
||||
for key, value := range service.Annotations {
|
||||
annotations[key] = value
|
||||
}
|
||||
annotations["kompose.cmd"] = strings.Join(os.Args, " ")
|
||||
version := exec.Command("kompose", "version")
|
||||
out, err := version.Output()
|
||||
if err != nil {
|
||||
errors.Wrap(err, "Failed to get kompose version")
|
||||
|
||||
}
|
||||
annotations["kompose.version"] = strings.Trim(string(out), " \n")
|
||||
return annotations
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user