Makefile: implement helper to process OpenShift templates
just for manual checks if the template syntax is fine and align with the github action to use the same code
This commit is contained in:
parent
1d0232ffc6
commit
0a68fe3005
3 changed files with 26 additions and 9 deletions
10
.github/workflows/tests.yml
vendored
10
.github/workflows/tests.yml
vendored
|
|
@ -276,15 +276,7 @@ jobs:
|
|||
- uses: redhat-actions/oc-installer@v1
|
||||
- name: Process template
|
||||
run: |
|
||||
mkdir processed-templates
|
||||
oc process -f templates/openshift/composer.yml \
|
||||
-p IMAGE_TAG=image_tag \
|
||||
--local \
|
||||
-o yaml > processed-templates/composer.yml
|
||||
oc process -f templates/openshift/maintenance.yml \
|
||||
-p IMAGE_TAG=image_tag \
|
||||
--local \
|
||||
-o yaml > processed-templates/maintenance.yml
|
||||
make process-templates
|
||||
|
||||
- uses: stackrox/kube-linter-action@v1.0.5
|
||||
with:
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -15,3 +15,5 @@ __pycache__
|
|||
/docs/osbuild-composer.7
|
||||
.cache
|
||||
container_composer_golangci_built.info
|
||||
processed-templates
|
||||
|
||||
|
|
|
|||
23
Makefile
23
Makefile
|
|
@ -89,6 +89,7 @@ help:
|
|||
@echo " push-check: Replicates the github workflow checks as close as possible"
|
||||
@echo " (do this before pushing!)"
|
||||
@echo " lint: Runs linters as close as github workflow as possible"
|
||||
@echo " process-templates: Execute the OpenShift CLI to check the templates"
|
||||
|
||||
$(BUILDDIR)/:
|
||||
mkdir -p "$@"
|
||||
|
|
@ -166,6 +167,7 @@ clean:
|
|||
rm -rf $(BUILDDIR)/bin/
|
||||
rm -rf $(CURDIR)/rpmbuild
|
||||
rm -rf container_composer_golangci_built.info
|
||||
rm -rf $(BUILDDIR)/$(PROCESSED_TEMPLATE_DIR)
|
||||
|
||||
.PHONY: push-check
|
||||
push-check: lint build unit-tests srpm man
|
||||
|
|
@ -293,3 +295,24 @@ container_composer_golangci_built.info: Makefile Containerfile_golangci_lint too
|
|||
.PHONY: lint
|
||||
lint: $(GOLANGCI_LINT_CACHE_DIR) container_composer_golangci_built.info
|
||||
podman run -t --rm -v $(SRCDIR):/app:z -v $(GOLANGCI_LINT_CACHE_DIR):/root/.cache:z -w /app $(GOLANGCI_COMPOSER_IMAGE) golangci-lint run -v
|
||||
|
||||
# The OpenShift CLI - maybe get it from https://access.redhat.com/downloads/content/290
|
||||
OC_EXECUTABLE ?= oc
|
||||
|
||||
OPENSHIFT_TEMPLATES_DIR := templates/openshift
|
||||
OPENSHIFT_TEMPLATES := $(notdir $(wildcard $(OPENSHIFT_TEMPLATES_DIR)/*.yml))
|
||||
|
||||
PROCESSED_TEMPLATE_DIR := $(BUILDDIR)/processed-templates
|
||||
|
||||
$(PROCESSED_TEMPLATE_DIR): $(BUILDDIR)
|
||||
mkdir -p $@
|
||||
|
||||
$(PROCESSED_TEMPLATE_DIR)/%.yml: $(PROCESSED_TEMPLATE_DIR) $(OPENSHIFT_TEMPLATES_DIR)/%.yml
|
||||
$(OC_EXECUTABLE) process -f $(OPENSHIFT_TEMPLATES_DIR)/$*.yml \
|
||||
-p IMAGE_TAG=image_tag \
|
||||
--local \
|
||||
-o yaml > $@
|
||||
|
||||
.PHONY: process-templates
|
||||
process-templates: $(addprefix $(PROCESSED_TEMPLATE_DIR)/, $(OPENSHIFT_TEMPLATES))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue