@@ -4,13 +4,11 @@ import (
44 "io"
55 "time"
66
7- "github.com/Masterminds/semver/v3"
87 "github.com/distribution/reference"
98 "github.com/rwx-cloud/cli/internal/accesstoken"
109 "github.com/rwx-cloud/cli/internal/api"
1110 "github.com/rwx-cloud/cli/internal/docker"
1211 "github.com/rwx-cloud/cli/internal/errors"
13- "github.com/rwx-cloud/cli/internal/versions"
1412)
1513
1614type Config struct {
@@ -187,15 +185,6 @@ func (c SetSecretsInVaultConfig) Validate() error {
187185 return nil
188186}
189187
190- type UpdateBaseConfig struct {
191- RwxDirectory string
192- Files []string
193- }
194-
195- func (c UpdateBaseConfig ) Validate () error {
196- return nil
197- }
198-
199188type UpdatePackagesConfig struct {
200189 RwxDirectory string
201190 Files []string
@@ -210,97 +199,33 @@ func (c UpdatePackagesConfig) Validate() error {
210199 return nil
211200}
212201
213- type ResolveBaseConfig struct {
202+ type InsertBaseConfig struct {
214203 RwxDirectory string
215204 Files []string
216- Os string
217- Tag string
218- Arch string
219205}
220206
221- func (c ResolveBaseConfig ) Validate () error {
207+ func (c InsertBaseConfig ) Validate () error {
222208 return nil
223209}
224210
225- type BaseLayerSpec struct {
226- Os string `yaml:"os"`
227- Tag string `yaml:"tag"`
228- Arch string `yaml:"arch"`
229- }
230-
231- func (b BaseLayerSpec ) TagVersion () * semver.Version {
232- if b .Tag == "" {
233- return versions .EmptyVersion
234- }
235-
236- return semver .MustParse (b .Tag )
237- }
238-
239- func (b BaseLayerSpec ) Equal (other BaseLayerSpec ) bool {
240- if b .Os != other .Os {
241- return false
242- }
243-
244- if b .Tag != other .Tag {
245- return false
246- }
247-
248- arch1 := b .Arch
249- if arch1 == "" {
250- arch1 = DefaultArch
251- }
252- arch2 := other .Arch
253- if arch2 == "" {
254- arch2 = DefaultArch
255- }
256- if arch1 != arch2 {
257- return false
258- }
259-
260- return true
261- }
262-
263- func (b BaseLayerSpec ) Merge (other BaseLayerSpec ) BaseLayerSpec {
264- os := b .Os
265- if other .Os != "" {
266- os = other .Os
267- }
268-
269- tag := b .Tag
270- if other .Tag != "" {
271- tag = other .Tag
272- }
273-
274- arch := b .Arch
275- if other .Arch != "" {
276- arch = other .Arch
277- }
278-
279- return BaseLayerSpec {
280- Os : os ,
281- Tag : tag ,
282- Arch : arch ,
283- }
211+ type BaseSpec struct {
212+ Image string `yaml:"image"`
213+ Config string `yaml:"config"`
214+ Arch string `yaml:"arch"`
284215}
285216
286217type BaseLayerRunFile struct {
287- Spec BaseLayerSpec
288- OriginalBase BaseLayerSpec
289- ResolvedBase BaseLayerSpec
218+ ResolvedBase BaseSpec
290219 OriginalPath string
291220 Error error
292221}
293222
294- func (rf BaseLayerRunFile ) HasChanges () bool {
295- return ! rf .OriginalBase .Equal (rf .ResolvedBase )
296- }
297-
298- type ResolveBaseResult struct {
223+ type InsertDefaultBaseResult struct {
299224 ErroredRunFiles []BaseLayerRunFile
300225 UpdatedRunFiles []BaseLayerRunFile
301226}
302227
303- func (r ResolveBaseResult ) HasChanges () bool {
228+ func (r InsertDefaultBaseResult ) HasChanges () bool {
304229 return len (r .ErroredRunFiles ) > 0 || len (r .UpdatedRunFiles ) > 0
305230}
306231
0 commit comments