Skip to content

Commit

Permalink
Fix: profile content checking when they have same name
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxerrante committed May 5, 2023
1 parent 02e9fd6 commit 5a97ba6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
18 changes: 9 additions & 9 deletions build/build-and-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ echo $GHCR_TOKEN | docker login -u "$(git config user.email)" --password-stdin g
docker push ghcr.io/tuxerrante/kapparmor:${APP_VERSION}_dev

# Install the chart from the local directory
helm upgrade kapparmor --install \
--atomic \
--timeout 60s \
--debug \
--set image.tag=${APP_VERSION}_dev \
--set image.pullPolicy=Always \
--dry-run \
charts/kapparmor
helm upgrade kapparmor --install \
--atomic \
--debug \
--set image.tag=${APP_VERSION}_dev \
--set image.pullPolicy=Always \
--dry-run \
charts/kapparmor

echo
echo "> Is the previous result the expected one?"
echo "> Current K8S context:" "$(kubectl config current-context)"
read -r -p "> Are you sure? [Y/n] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
helm upgrade kapparmor --install \
--atomic \
--timeout 60s \
--timeout 120s \
--debug \
--set image.tag=${APP_VERSION}_dev \
--set image.pullPolicy=Always \
Expand Down
3 changes: 2 additions & 1 deletion build/build-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ docker build --target test-coverage --tag "ghcr.io/tuxerrante/kapparmor:${APP_VE
echo "> Building container image..."
docker build --tag "ghcr.io/tuxerrante/kapparmor:${APP_VERSION}_dev" \
--no-cache \
--build-arg POLL_TIME=60 --build-arg PROFILES_DIR=/app/profiles \
--build-arg POLL_TIME=30 \
--build-arg PROFILES_DIR=/app/profiles \
-f Dockerfile \
.

Expand Down
2 changes: 1 addition & 1 deletion go/src/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func loadNewProfiles() ([]string, error) {

// If the profile is exactly the same skip the apply
log.Printf("Checking %s profile..", path.Join(CONFIGMAP_PATH, newProfileName))
contentIsTheSame, err := HasTheSameContent(nil, filePath1, path.Join(CONFIGMAP_PATH, newProfileName))
contentIsTheSame, err := HasTheSameContent(nil, filePath1, path.Join(ETC_APPARMORD, newProfileName))
if err != nil {
// Error in checking the content of "/app/profiles/custom.deny-write-outside-app" VS "custom.deny-write-outside-app"
log.Printf(">> Error in checking the content of %q VS %q\n", filePath1, newProfileName)
Expand Down

0 comments on commit 5a97ba6

Please sign in to comment.