Skip to content

Commit

Permalink
feat(package): adds provision to specify pull policy for docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
swagnikdutta authored and pallabpain committed Jun 8, 2023
1 parent b5ec154 commit 42ca473
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions riocli/apply/manifests/package-nonros-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ spec:
memory: 128 # Unit: MB (Optional)
docker:
image: "busybox:latest"
imagePullPolicy: "Always" # Always, Never, IfNotPresent(default)
pullSecret:
depends:
kind: secret
Expand Down
1 change: 1 addition & 0 deletions riocli/apply/manifests/package-ros-device-no-rosbag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ spec:
memory: 128 # Unit: MB (Optional)
docker:
image: "busybox:latest"
imagePullPolicy: "Always" # Always, Never, IfNotPresent(default)
pullSecret:
depends:
kind: secret
Expand Down
1 change: 1 addition & 0 deletions riocli/apply/manifests/package-ros-device-rosbag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ spec:
memory: 128 # Unit: MB (Optional)
docker:
image: "busybox:latest"
imagePullPolicy: "Always" # Always, Never, IfNotPresent(default)
pullSecret:
depends:
kind: secret
Expand Down
3 changes: 3 additions & 0 deletions riocli/apply/manifests/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ spec:
memory: 128 # Unit: MB (Optional)
docker:
image: "busybox:latest"
imagePullPolicy: "Always" # Always, Never, IfNotPresent(default)
pullSecret:
depends:
kind: secret
Expand Down Expand Up @@ -389,6 +390,7 @@ spec:
memory: 128 # Unit: MB (Optional)
docker:
image: "busybox:latest"
imagePullPolicy: "Always" # Always, Never, IfNotPresent(default)
pullSecret:
depends:
kind: secret
Expand Down Expand Up @@ -442,6 +444,7 @@ spec:
memory: 128 # Unit: MB (Optional)
docker:
image: "busybox:latest"
imagePullPolicy: "Always" # Always, Never, IfNotPresent(default)
pullSecret:
depends:
kind: secret
Expand Down
9 changes: 9 additions & 0 deletions riocli/jsonschema/schemas/package-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ definitions:
properties:
image:
"$ref": "#/definitions/imageName"
imagePullPolicy:
"$ref": "#/definitions/imagePullPolicy"
pullSecret:
"$ref": "#/definitions/secretDepends"
required:
Expand Down Expand Up @@ -660,6 +662,13 @@ definitions:
imageName:
type: string
pattern: ^([a-zA-Z0-9])([\w.\-_]+((?::\d+|)(?=/[a-z0-9._-]+/[a-z0-9._-]+))|)(?:/|)([a-z0-9.\-_]+(?:/[a-z0-9.\-_]+|))(:([\w.\-_]{1,126})|)$
imagePullPolicy:
type: string
enum:
- Always
- IfNotPresent
- Never
default: IfNotPresent

buildDepends:
properties:
Expand Down
3 changes: 3 additions & 0 deletions riocli/package/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def _map_executable(self, exec):
secret_guid, secret = self.rc.find_depends(exec.docker.pullSecret.depends)
exec_object.secret = secret_guid

if exec.docker.get('imagePullPolicy'):
exec_object.imagePullPolicy = exec.docker.imagePullPolicy

if exec.type == 'build':
exec_object.buildGUID = exec.build.depends.guid
# TODO verify this is right for secret?
Expand Down

0 comments on commit 42ca473

Please sign in to comment.