diff --git a/README.md b/README.md index c2a0c29..5bdf7f2 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,12 @@ resources: ### `check`: Produce a single dummy key -The resource uses the `version` identifier of the resource as a way to pass the data between jobs. -Check returns a single `dummy` key that will be discarded and only used to satisfy the `check` behavior. +This is a version-less resource so `check` behavior is no-op ### `in`: Report the given time. Fetches the given key values and stores them in the `keyval.properties` file. The format is of a `.properties` file, e.g. `"="`. -Key values are also reported as the metadata. #### Parameters @@ -60,7 +58,6 @@ Reads the given properties file and sets them for the next job. #### Parameters - file - the properties file to read the key values from - ## Examples ```YAML @@ -78,8 +75,6 @@ jobs: - name: build plan: - - aggregate: - - get: keyval - task: build file: tools/tasks/build/task.yml - put: keyval @@ -96,7 +91,7 @@ jobs: file: tools/tasks/task.yml ``` -The build job gets an empty file in `keyval/keyval.properties`. It then writes all the key values it needs to pass along (e.g. artifact id) in the `keyvalout/keyval.properties` file. +The build job writes all the key values it needs to pass along (e.g. artifact id) in the `keyvalout/keyval.properties` file. The test-deploy can read the data from the `keyval/keyval.properties` file and use them as it pleases. ## CI suggestions diff --git a/check/check_test.go b/check/check_test.go index a508633..17f7af8 100644 --- a/check/check_test.go +++ b/check/check_test.go @@ -54,9 +54,8 @@ var _ = Describe("Check", func() { }) Context("when no version is given", func() { - It("outputs an empty version", func() { - Expect(response).To(HaveLen(1)) - Expect(response[0].Dummy).To(Equal("dummy")) + It("outputs an empty version array", func() { + Expect(response).To(HaveLen(0)) }) }) @@ -64,13 +63,11 @@ var _ = Describe("Check", func() { BeforeEach(func() { version = &models.EmptyVersion{ - Dummy: "dummy", } }) - It("outputs an empty version", func() { - Expect(response).To(HaveLen(1)) - Expect(response[0].Dummy).To(Equal("dummy")) + It("outputs an empty version array", func() { + Expect(response).To(HaveLen(0)) }) }) diff --git a/check/main.go b/check/main.go index 29dfce5..83bb756 100644 --- a/check/main.go +++ b/check/main.go @@ -16,8 +16,5 @@ func main() { os.Exit(1) } versions := []models.EmptyVersion{} - versions = append(versions, models.EmptyVersion{ - Dummy: "dummy", - }) json.NewEncoder(os.Stdout).Encode(versions) } diff --git a/in/in_test.go b/in/in_test.go index 5a4ca7b..c6b2c96 100644 --- a/in/in_test.go +++ b/in/in_test.go @@ -47,7 +47,6 @@ var _ = Describe("In", func() { Version: models.Version{ "a": "1", "b": "2", - "dummy": "dummy", }, Source: models.Source{}, } @@ -72,16 +71,10 @@ var _ = Describe("In", func() { Expect(err).NotTo(HaveOccurred()) }) - It("reports the version and metadata to be the input version", func() { + It("reports the version to be the input version", func() { Expect(len(response.Version)).To(Equal(2)) Expect(response.Version["a"]).To(Equal("1")) Expect(response.Version["b"]).To(Equal("2")) - - Expect(len(response.Metadata)).To(Equal(2)) - Expect(response.Metadata[0].Name).To(Equal("a")) - Expect(response.Metadata[0].Value).To(Equal("1")) - Expect(response.Metadata[1].Name).To(Equal("b")) - Expect(response.Metadata[1].Value).To(Equal("2")) }) It("writes the requested data the destination", func() { @@ -100,7 +93,6 @@ var _ = Describe("In", func() { It("reports empty data", func() { Expect(len(response.Version)).To(Equal(0)) - Expect(len(response.Metadata)).To(Equal(0)) var data = properties.MustLoadFile(filepath.Join(destination, "keyval.properties"),properties.UTF8).Map(); Expect(len(data)).To(Equal(0)) }) diff --git a/in/main.go b/in/main.go index c48594f..6b9eb03 100644 --- a/in/main.go +++ b/in/main.go @@ -39,12 +39,9 @@ func main() { } var inVersion = request.Version - var metadata = models.Metadata{} w := bufio.NewWriter(file) - delete(inVersion,"dummy") - var keys []string for k := range inVersion { keys = append(keys, k) @@ -53,10 +50,6 @@ func main() { for _, k := range keys { fmt.Fprintf(w, "%s=%s\n", k, inVersion[k]) - metadata = append(metadata, models.MetadataField{ - Name: k, - Value: inVersion[k], - }) } err = w.Flush() @@ -67,7 +60,6 @@ func main() { json.NewEncoder(os.Stdout).Encode(models.InResponse{ Version: inVersion, - Metadata: metadata, }) } diff --git a/models/models.go b/models/models.go index 846107a..c1a4225 100644 --- a/models/models.go +++ b/models/models.go @@ -1,7 +1,6 @@ package models type EmptyVersion struct { - Dummy string `json:"dummy"` } type Version map[string]string @@ -13,7 +12,6 @@ type InRequest struct { type InResponse struct { Version Version `json:"version"` - Metadata Metadata `json:"metadata"` } type OutParams struct { @@ -27,7 +25,6 @@ type OutRequest struct { type OutResponse struct { Version Version `json:"version"` - Metadata Metadata `json:"metadata"` } type CheckRequest struct { @@ -39,9 +36,3 @@ type CheckResponse []EmptyVersion type Source struct {} -type Metadata []MetadataField - -type MetadataField struct { - Name string `json:"name"` - Value string `json:"value"` -} diff --git a/out/main.go b/out/main.go index c44a02e..a2f8c1e 100644 --- a/out/main.go +++ b/out/main.go @@ -33,18 +33,8 @@ func main() { } sort.Strings(keys) - var metadata = models.Metadata{} - - for _, k := range keys { - metadata = append(metadata, models.MetadataField{ - Name: k, - Value: data[k], - }) - } - json.NewEncoder(os.Stdout).Encode(models.OutResponse{ Version: data, - Metadata: metadata, }) } else { println("no properties file specified") diff --git a/out/out_test.go b/out/out_test.go index 2517f88..8a6620f 100644 --- a/out/out_test.go +++ b/out/out_test.go @@ -86,12 +86,6 @@ var _ = Describe("Out", func() { Expect(len(response.Version)).To(Equal(2)) Expect(response.Version["a"]).To(Equal("1")) Expect(response.Version["b"]).To(Equal("2")) - - Expect(len(response.Metadata)).To(Equal(2)) - Expect(response.Metadata[0].Name).To(Equal("a")) - Expect(response.Metadata[0].Value).To(Equal("1")) - Expect(response.Metadata[1].Name).To(Equal("b")) - Expect(response.Metadata[1].Value).To(Equal("2")) }) }) @@ -110,7 +104,6 @@ var _ = Describe("Out", func() { It("reports empty data", func() { Expect(len(response.Version)).To(Equal(0)) - Expect(len(response.Metadata)).To(Equal(0)) }) })