Skip to content

Commit c9878e1

Browse files
authored
Remove images from local disk once they are pushed to the registry (#129)
* Remove images from local disk once they are pushed to the registry * try by putting trex first * Fix nfv-example-cnf-index build
1 parent efb3219 commit c9878e1

File tree

9 files changed

+118
-17
lines changed

9 files changed

+118
-17
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL := /bin/bash
22

3-
DIRS := testpmd-container-app trex-container-app grout-container-app testpmd-operator trex-operator grout-operator nfv-example-cnf-index
3+
DIRS := trex-container-app testpmd-container-app grout-container-app trex-operator testpmd-operator grout-operator nfv-example-cnf-index
44

55
OPERATOR_SDK_VER:= 1.41.1
66

generate-versions.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ fi
1010
VERSIONS="$1"
1111
EXTRA="$2"
1212

13-
DIRS="testpmd-container-app trex-container-app grout-container-app testpmd-operator trex-operator grout-operator nfv-example-cnf-index"
13+
DIRS="trex-container-app testpmd-container-app grout-container-app trex-operator testpmd-operator grout-operator nfv-example-cnf-index"
1414

1515
FILES="$(git diff --name-only -r origin/${GITHUB_BASE_REF:-main}:|grep -Fv /.git || :)"
1616

17-
TESTPMD_APP=false
1817
TREX_APP=false
18+
TESTPMD_APP=false
1919
GROUT_APP=false
2020

2121
echo "declare -A VERSIONS" > "$VERSIONS"
@@ -26,13 +26,13 @@ for d in $DIRS; do
2626
# Force to build the operators if the corresponding app is built
2727
force=false
2828
case "$d" in
29-
testpmd-operator)
30-
if [ "$TESTPMD_APP" == true ]; then
29+
trex-operator)
30+
if [ "$TREX_APP" == true ]; then
3131
force=true
3232
fi
3333
;;
34-
trex-operator)
35-
if [ "$TREX_APP" == true ]; then
34+
testpmd-operator)
35+
if [ "$TESTPMD_APP" == true ]; then
3636
force=true
3737
fi
3838
;;
@@ -49,12 +49,12 @@ for d in $DIRS; do
4949
echo "VERSIONS[$d]=$vers-$EXTRA" >> "$VERSIONS"
5050
echo "$d"
5151
count=$((count + 1))
52-
if [ "$d" == testpmd-container-app ]; then
53-
TESTPMD_APP=true
54-
fi
5552
if [ "$d" == trex-container-app ]; then
5653
TREX_APP=true
5754
fi
55+
if [ "$d" == testpmd-container-app ]; then
56+
TESTPMD_APP=true
57+
fi
5858
if [ "$d" == grout-container-app ]; then
5959
GROUT_APP=true
6060
fi

grout-container-app/Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ targets:
1717
@awk -F: '/^.PHONY/ {print $$2}' Makefile | column -t -s '#'
1818

1919
.PHONY: all # Build and push all images
20-
all: build-all push-all
20+
all: build-all push-all rmi-all
2121

2222
.PHONY: cnfapp-dependencies # Get dependencies for cnfapp
2323
cnfapp-dependencies:
@@ -45,6 +45,16 @@ push-cnfapp: build-cnfapp
4545
$(CONTAINER_CLI) push "$(REGISTRY)/$(ORG)/grout-container-app-$(@:push-%=%):v$(VERSION)"; \
4646
fi
4747

48+
.PHONY: rmi-all # Remove ALL images locally
49+
rmi-all: rmi-cnfapp
50+
51+
.PHONY: rmi-cnfapp # Remove cnfapp image from local storage
52+
rmi-cnfapp: push-cnfapp
53+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/grout-container-app-$(@:rmi-%=%):v$(TAG)"
54+
if [ -n "$(RELEASE)" ]; then \
55+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/grout-container-app-$(@:rmi-%=%):v$(VERSION)"; \
56+
fi
57+
4858
.PHONY: version # Display the version
4959
version:
5060
@echo $(VERSION)

grout-operator/Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,32 @@ REL_IMG ?= $(IMAGE_TAG_BASE):v$(VERSION)
7373
# Our general, custom tasks
7474

7575
.PHONY: all
76-
all: operator-all bundle-all
76+
all: operator-all bundle-all rmi-all
7777

7878
.PHONY: build-all
7979
build-all: operator-build bundle-build
8080

8181
.PHONY: push-all
8282
push-all: operator-push bundle-push
8383

84+
.PHONY: rmi-all
85+
rmi-all: operator-rmi bundle-rmi
86+
87+
.PHONY: operator-rmi
88+
operator-rmi: operator-push
89+
$(CONTAINER_CLI) rmi -f ${IMG}
90+
if [ -n "$(RELEASE)" ]; then \
91+
$(CONTAINER_CLI) rmi -f ${REL_IMG}; \
92+
fi
93+
94+
.PHONY: bundle-rmi
95+
bundle-rmi: bundle-push
96+
$(CONTAINER_CLI) rmi -f $(BUNDLE_IMG)
97+
if [ -n "$(RELEASE)" ]; then \
98+
$(CONTAINER_CLI) rmi -f $(REL_BUNDLE_IMG); \
99+
fi
100+
$(CONTAINER_CLI) rmi -f bundle
101+
84102
# Operator build and push
85103
.PHONY: operator-all
86104
operator-all: operator-build operator-push

nfv-example-cnf-index/Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@ ARCH := $(shell uname -m | sed 's/x86_64/amd64/')
1717
OPERATORS_LIST := operators.cfg
1818
SHELL := /bin/bash
1919

20-
all: index-build index-push
20+
all: index-build index-push rmi-all
2121

2222
build-all: index-build
2323

2424
push-all: index-push
2525

26+
.PHONY: rmi-all # Remove ALL images locally
27+
rmi-all: rmi-index
28+
29+
.PHONY: rmi-index # Remove index image from local storage
30+
rmi-index: index-push
31+
$(CONTAINER_CLI) rmi -f $(INDEX_IMG)
32+
if [ -n "$(RELEASE)" ]; then \
33+
$(CONTAINER_CLI) rmi -f $(REL_INDEX_IMG); \
34+
fi
35+
2636
# Clean up
2737
clean:
2838
@rm -rf $(BUILD_PATH)

testpmd-container-app/Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ targets:
1717
@awk -F: '/^.PHONY/ {print $$2}' Makefile | column -t -s '#'
1818

1919
.PHONY: all # Build and push all images
20-
all: build-all push-all
20+
all: build-all push-all rmi-all
2121

2222
.PHONY: cnfapp-dependencies # Get dependencies for cnfapp
2323
cnfapp-dependencies:
@@ -45,6 +45,16 @@ push-cnfapp: build-cnfapp
4545
$(CONTAINER_CLI) push "$(REGISTRY)/$(ORG)/testpmd-container-app-$(@:push-%=%):v$(VERSION)"; \
4646
fi
4747

48+
.PHONY: rmi-all # Remove ALL images locally
49+
rmi-all: rmi-cnfapp
50+
51+
.PHONY: rmi-cnfapp # Remove cnfapp image from local storage
52+
rmi-cnfapp: push-cnfapp
53+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/testpmd-container-app-$(@:rmi-%=%):v$(TAG)"
54+
if [ -n "$(RELEASE)" ]; then \
55+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/testpmd-container-app-$(@:rmi-%=%):v$(VERSION)"; \
56+
fi
57+
4858
.PHONY: version # Display the version
4959
version:
5060
@echo $(VERSION)

testpmd-operator/Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,32 @@ REL_IMG ?= $(IMAGE_TAG_BASE):v$(VERSION)
7373
# Our general, custom tasks
7474

7575
.PHONY: all
76-
all: operator-all bundle-all
76+
all: operator-all bundle-all rmi-all
7777

7878
.PHONY: build-all
7979
build-all: operator-build bundle-build
8080

8181
.PHONY: push-all
8282
push-all: operator-push bundle-push
8383

84+
.PHONY: rmi-all
85+
rmi-all: operator-rmi bundle-rmi
86+
87+
.PHONY: operator-rmi
88+
operator-rmi: operator-push
89+
$(CONTAINER_CLI) rmi -f ${IMG}
90+
if [ -n "$(RELEASE)" ]; then \
91+
$(CONTAINER_CLI) rmi -f ${REL_IMG}; \
92+
fi
93+
94+
.PHONY: bundle-rmi
95+
bundle-rmi: bundle-push
96+
$(CONTAINER_CLI) rmi -f $(BUNDLE_IMG)
97+
if [ -n "$(RELEASE)" ]; then \
98+
$(CONTAINER_CLI) rmi -f $(REL_BUNDLE_IMG); \
99+
fi
100+
$(CONTAINER_CLI) rmi -f bundle
101+
84102
# Operator build and push
85103
.PHONY: operator-all
86104
operator-all: operator-build operator-push

trex-container-app/Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ targets:
1717
@awk -F: '/^.PHONY/ {print $$2}' Makefile | column -t -s '#'
1818

1919
.PHONY: all # Build and push all images
20-
all: build-all push-all
20+
all: build-all push-all rmi-all
2121

2222
.PHONY: server-dependencies # Include dependencies for server
2323
server-dependencies:
@@ -65,6 +65,23 @@ push-app: build-app
6565
$(CONTAINER_CLI) push "$(REGISTRY)/$(ORG)/trex-container-$(@:push-%=%):v$(VERSION)"; \
6666
fi
6767

68+
.PHONY: rmi-all # Remove ALL images locally
69+
rmi-all: rmi-server rmi-app
70+
71+
.PHONY: rmi-server # Remove TRex Server image from local storage
72+
rmi-server: push-server
73+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/trex-container-$(@:rmi-%=%):v$(TAG)"
74+
if [ -n "$(RELEASE)" ]; then \
75+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/trex-container-$(@:rmi-%=%):v$(VERSION)"; \
76+
fi
77+
78+
.PHONY: rmi-app # Remove TRex App image from local storage
79+
rmi-app: push-app
80+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/trex-container-$(@:rmi-%=%):v$(TAG)"
81+
if [ -n "$(RELEASE)" ]; then \
82+
$(CONTAINER_CLI) rmi -f "$(REGISTRY)/$(ORG)/trex-container-$(@:rmi-%=%):v$(VERSION)"; \
83+
fi
84+
6885
.PHONY: version # Display the version
6986
version:
7087
@echo $(VERSION)

trex-operator/Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,32 @@ REL_IMG ?= $(IMAGE_TAG_BASE):v$(VERSION)
7171
# Our general, custom tasks
7272

7373
.PHONY: all
74-
all: operator-all bundle-all
74+
all: operator-all bundle-all rmi-all
7575

7676
.PHONY: build-all
7777
build-all: operator-build bundle-build
7878

7979
.PHONY: push-all
8080
push-all: operator-push bundle-push
8181

82+
.PHONY: rmi-all
83+
rmi-all: operator-rmi bundle-rmi
84+
85+
.PHONY: operator-rmi
86+
operator-rmi: operator-push
87+
$(CONTAINER_CLI) rmi -f ${IMG}
88+
if [ -n "$(RELEASE)" ]; then \
89+
$(CONTAINER_CLI) rmi -f ${REL_IMG}; \
90+
fi
91+
92+
.PHONY: bundle-rmi
93+
bundle-rmi: bundle-push
94+
$(CONTAINER_CLI) rmi -f $(BUNDLE_IMG)
95+
if [ -n "$(RELEASE)" ]; then \
96+
$(CONTAINER_CLI) rmi -f $(REL_BUNDLE_IMG); \
97+
fi
98+
$(CONTAINER_CLI) rmi -f bundle
99+
82100
# Operator build and push
83101
.PHONY: operator-all
84102
operator-all: operator-build operator-push

0 commit comments

Comments
 (0)