From 22dce7343f4a1db9013bdea8062d414e4d1c44ee Mon Sep 17 00:00:00 2001 From: Ghada Khalil Date: Mon, 9 May 2022 21:36:54 +0000 Subject: [PATCH] Revert "debian: stx-audit: port to debian" This reverts commit 4b2004a95e526e8fdb837a28aac8d48f9b79997c. Reason for revert: Introduced a new issue as reported in https://bugs.launchpad.net/starlingx/+bug/1972732 Closes-Bug: 1972732 Change-Id: I56353f8929175f2303a67fa3a748468d6a4655ef --- debian_stable_docker_images.inc | 1 - .../docker/stx-audit/Dockerfile} | 0 .../docker}/stx-audit/startAuditd.sh | 0 stx-audit-helm/centos/stx-audit-helm.spec | 4 ++-- .../stx-snmp-helm-audit.stable_docker_image | 3 +-- stx-audit-helm/debian/.gitignore | 1 - stx-audit-helm/debian/deb_folder/rules | 4 ++-- .../stx-snmp-helm-audit.stable_docker_image | 4 ---- .../stx-audit-helm/helm-charts/.gitignore | 1 - .../stx-audit-helm/helm-charts/Makefile | 23 ++----------------- .../helm-charts/audit/templates/_helpers.tpl | 7 ------ .../audit/templates/daemonset.yaml | 2 +- .../helm-charts/audit/values.yaml | 7 +----- stx-audit-helm/stx-audit/Dockerfile.debian | 20 ---------------- tox.ini | 12 ++-------- 15 files changed, 11 insertions(+), 78 deletions(-) delete mode 100644 debian_stable_docker_images.inc rename stx-audit-helm/{stx-audit/Dockerfile.centos => centos/docker/stx-audit/Dockerfile} (100%) rename stx-audit-helm/{ => centos/docker}/stx-audit/startAuditd.sh (100%) delete mode 100644 stx-audit-helm/debian/.gitignore delete mode 100755 stx-audit-helm/debian/stx-snmp-helm-audit.stable_docker_image delete mode 100644 stx-audit-helm/stx-audit-helm/helm-charts/.gitignore delete mode 100644 stx-audit-helm/stx-audit/Dockerfile.debian diff --git a/debian_stable_docker_images.inc b/debian_stable_docker_images.inc deleted file mode 100644 index cc62b53..0000000 --- a/debian_stable_docker_images.inc +++ /dev/null @@ -1 +0,0 @@ -stx-audit-helm diff --git a/stx-audit-helm/stx-audit/Dockerfile.centos b/stx-audit-helm/centos/docker/stx-audit/Dockerfile similarity index 100% rename from stx-audit-helm/stx-audit/Dockerfile.centos rename to stx-audit-helm/centos/docker/stx-audit/Dockerfile diff --git a/stx-audit-helm/stx-audit/startAuditd.sh b/stx-audit-helm/centos/docker/stx-audit/startAuditd.sh similarity index 100% rename from stx-audit-helm/stx-audit/startAuditd.sh rename to stx-audit-helm/centos/docker/stx-audit/startAuditd.sh diff --git a/stx-audit-helm/centos/stx-audit-helm.spec b/stx-audit-helm/centos/stx-audit-helm.spec index 5e4d685..5a72c23 100644 --- a/stx-audit-helm/centos/stx-audit-helm.spec +++ b/stx-audit-helm/centos/stx-audit-helm.spec @@ -50,7 +50,7 @@ StarlingX Auditd Application FluxCD Helm Charts %build cd helm-charts -make VARIANTS=centos +make cd - # Create a chart tarball compliant with sysinv kube-app.py @@ -63,7 +63,7 @@ mkdir -p %{app_staging} cp files/metadata.yaml %{app_staging} cp manifests/auditd_manifest.yaml %{app_staging} mkdir -p %{app_staging}/charts -cp helm-charts/.build/centos/*.tgz %{app_staging}/charts +cp helm-charts/*.tgz %{app_staging}/charts cd %{app_staging} # Populate metadata diff --git a/stx-audit-helm/centos/stx-snmp-helm-audit.stable_docker_image b/stx-audit-helm/centos/stx-snmp-helm-audit.stable_docker_image index 480830a..8501dcb 100755 --- a/stx-audit-helm/centos/stx-snmp-helm-audit.stable_docker_image +++ b/stx-audit-helm/centos/stx-snmp-helm-audit.stable_docker_image @@ -1,4 +1,3 @@ BUILDER=docker LABEL=stx-audit -DOCKER_CONTEXT=../stx-audit -DOCKER_FILE=../stx-audit/Dockerfile.centos +DOCKER_CONTEXT=docker/stx-audit diff --git a/stx-audit-helm/debian/.gitignore b/stx-audit-helm/debian/.gitignore deleted file mode 100644 index 82520ca..0000000 --- a/stx-audit-helm/debian/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/tmp/ diff --git a/stx-audit-helm/debian/deb_folder/rules b/stx-audit-helm/debian/deb_folder/rules index dcd9c8b..072daf2 100755 --- a/stx-audit-helm/debian/deb_folder/rules +++ b/stx-audit-helm/debian/deb_folder/rules @@ -20,13 +20,13 @@ export STAGING = staging override_dh_auto_build: # Create the TGZ file. - cd helm-charts && make VARIANTS=debian + cd helm-charts && make # Setup the staging directory. mkdir -p $(STAGING) cp files/metadata.yaml $(STAGING) cp manifests/*.yaml $(STAGING) mkdir -p $(STAGING)/charts - cp helm-charts/.build/debian/*.tgz $(STAGING)/charts + cp helm-charts/*.tgz $(STAGING)/charts # Populate metadata. sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING)/metadata.yaml sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING)/metadata.yaml diff --git a/stx-audit-helm/debian/stx-snmp-helm-audit.stable_docker_image b/stx-audit-helm/debian/stx-snmp-helm-audit.stable_docker_image deleted file mode 100755 index 49ff65d..0000000 --- a/stx-audit-helm/debian/stx-snmp-helm-audit.stable_docker_image +++ /dev/null @@ -1,4 +0,0 @@ -BUILDER=docker -LABEL=stx-audit -DOCKER_CONTEXT=../stx-audit -DOCKER_FILE=../stx-audit/Dockerfile.debian diff --git a/stx-audit-helm/stx-audit-helm/helm-charts/.gitignore b/stx-audit-helm/stx-audit-helm/helm-charts/.gitignore deleted file mode 100644 index 30bcfa4..0000000 --- a/stx-audit-helm/stx-audit-helm/helm-charts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.build/ diff --git a/stx-audit-helm/stx-audit-helm/helm-charts/Makefile b/stx-audit-helm/stx-audit-helm/helm-charts/Makefile index 3a79e69..dc98968 100644 --- a/stx-audit-helm/stx-audit-helm/helm-charts/Makefile +++ b/stx-audit-helm/stx-audit-helm/helm-charts/Makefile @@ -9,25 +9,11 @@ SHELL := /bin/bash TASK := build -EXCLUDES := helm-toolkit doc tests tools logs tmp .build +EXCLUDES := helm-toolkit doc tests tools logs tmp CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) -VARIANTS := centos debian .PHONY: $(EXCLUDES) $(CHARTS) -# Usage: $(call helm-package,VARIANT,CHART_SRC_DIR) -# Build the specified variant of a chart by replacing -# "variant = ..." with VARIANT -define helm-package - { \ - rm -rf .build/$(1)/$(2) && \ - mkdir -p .build/$(1) && \ - cp -ar $(2) .build/$(1)/$(2) && \ - sed -i 's#^\(\s*variant\s*:\s*\).*#\1'"$(1)"'#' .build/$(1)/$(2)/values.yaml && \ - helm package -d .build/$(1) .build/$(1)/$(2) ; \ - } -endef - all: $(CHARTS) $(CHARTS): @@ -45,18 +31,13 @@ lint-%: init-% if [ -d $* ]; then helm lint $*; fi build-%: - if [ -d $* ]; then \ - for variant in $(VARIANTS) ; do \ - $(call helm-package,$$variant,$*) || exit 1 ; \ - done ; \ - fi + if [ -d $* ]; then helm package $*; fi clean: @echo "Clean all build artifacts" rm -f */templates/_partials.tpl */templates/_globals.tpl rm -f *tgz */charts/*tgz */requirements.lock rm -rf */charts */tmpcharts - rm -rf .build %: @: diff --git a/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/_helpers.tpl b/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/_helpers.tpl index 0db934e..c8fca8b 100755 --- a/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/_helpers.tpl +++ b/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/_helpers.tpl @@ -31,10 +31,3 @@ Create chart name and version as used by the chart label. {{- define "audit.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} - -{{/* -Define the image tag -*/}} -{{- define "audit.image.tag" -}} -{{ get .Values.image.tags .Values.variant }} -{{- end -}} diff --git a/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/daemonset.yaml b/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/daemonset.yaml index 381fa2b..57ca069 100644 --- a/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/daemonset.yaml +++ b/stx-audit-helm/stx-audit-helm/helm-charts/audit/templates/daemonset.yaml @@ -29,7 +29,7 @@ spec: effect: NoSchedule containers: - name: {{ include "audit.name" . }} - image: '{{ .Values.image.repository }}:{{ include "audit.image.tag" . }}' + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} securityContext: privileged: true diff --git a/stx-audit-helm/stx-audit-helm/helm-charts/audit/values.yaml b/stx-audit-helm/stx-audit-helm/helm-charts/audit/values.yaml index 8c12ec5..6a1e8c0 100755 --- a/stx-audit-helm/stx-audit-helm/helm-charts/audit/values.yaml +++ b/stx-audit-helm/stx-audit-helm/helm-charts/audit/values.yaml @@ -2,16 +2,11 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -# must match one of image.tags below -variant: centos - image: repository: docker.io/starlingx/stx-audit + tag: stx.6.0-v1.0.3 pullPolicy: IfNotPresent debug: '' - tags: - centos: stx.6.0-v1.0.3 - debian: stx.6.0-v1.0.3 nameOverride: "" fullnameOverride: "" diff --git a/stx-audit-helm/stx-audit/Dockerfile.debian b/stx-audit-helm/stx-audit/Dockerfile.debian deleted file mode 100644 index 74253bb..0000000 --- a/stx-audit-helm/stx-audit/Dockerfile.debian +++ /dev/null @@ -1,20 +0,0 @@ -ARG BASE -FROM ${BASE} AS stx - -ENV DEBIAN_FRONTEND=noninteractive - -RUN rm -f /etc/apt/sources.list.d/*.list && \ - cp /etc/apt/sources.list.d/debian.list.disabled /etc/apt/sources.list.d/debian.list && \ - apt-get -y update && \ - apt-get -y install auditd && \ - apt-get -y clean && \ - rm -rf /var/lib/apt/lists/* - -COPY startAuditd.sh . - -RUN mkdir -p /etc/audit && \ - touch /etc/audit/audit.rules && \ - chmod 600 /etc/audit/audit.rules - -RUN chmod 755 startAuditd.sh -ENTRYPOINT ["./startAuditd.sh"] diff --git a/tox.ini b/tox.ini index 4ed647e..807555b 100644 --- a/tox.ini +++ b/tox.ini @@ -22,11 +22,7 @@ whitelist_externals = # Treat all E* codes as Errors rather than warnings using: -e 'E*' commands = bash -c "find {toxinidir} \ - \( \ - -type d \ - \( -name .?\* -o -name tmp \) \ - -prune \ - \) \ + -not \( -type d -name .?\* -prune \) \ -type f \ -not -name \*~ \ -not -name \*.md \ @@ -45,11 +41,7 @@ basepython=python3 commands = bash -c "find {toxinidir} \ - \( \ - -type d \ - \( -name .?\* -o -name tmp \) \ - -prune \ - \) \ + -name .tox -prune \ -o -type f -name '*.yaml' \ -print0 | xargs -0 yamllint -d relaxed -f parsable"