Feat add custom build push (#1630)

* feat: support custom build and push commands

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>

* test: add functional tests of the support of custom build and push

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>

* docs: add docs of the support of custom build and push

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>

---------

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
This commit is contained in:
AhmedGrati
2023-07-05 11:37:28 +01:00
committed by GitHub
parent f7bee839ce
commit b0d46a4ce3
8 changed files with 101 additions and 0 deletions
+5
View File
@@ -272,3 +272,8 @@ convert::expect_success "$os_cmd" "$os_output"
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/network-policies/docker-compose.yaml convert --generate-network-policies --stdout --with-kompose-annotation=false"
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/network-policies/output-k8s.yaml"
convert::expect_success "$os_cmd" "$os_output"
# Test support for custom build and push images
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/custom-build-push/docker-compose.yaml convert --build-command 'docker build -t ahmedgrati/kompose-test ./script/test/fixtures/custom-build-push' --push-command 'docker push ahmedgrati/kompose-test' --stdout --with-kompose-annotation=false"
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/custom-build-push/output-k8s.yaml"
convert::expect_success "$os_cmd" "$os_output"
+3
View File
@@ -0,0 +1,3 @@
FROM busybox
CMD ["sleep", "4800"]
@@ -0,0 +1,10 @@
version: '3.8'
networks:
web:
services:
nginx:
image: nginx
networks:
- web
+44
View File
@@ -0,0 +1,44 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: nginx
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.network/custom-build-push-web: "true"
io.kompose.service: nginx
spec:
containers:
- image: nginx
name: nginx
resources: {}
restartPolicy: Always
status: {}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
creationTimestamp: null
name: custom-build-push-web
spec:
ingress:
- from:
- podSelector:
matchLabels:
io.kompose.network/custom-build-push-web: "true"
podSelector:
matchLabels:
io.kompose.network/custom-build-push-web: "true"