Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
isindir committed Jan 11, 2024
1 parent 5e5a793 commit 0888e44
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 4 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,101 @@ jobs:

- name: Unit tests and envtest integration tests
run: make test

# k3d integration tests
- name: In cluster integration tests
run: |
export GNUPGHOME="$(mktemp -d)"
cat >$GNUPGHOME/foo <<EOF
%echo Generating a basic OpenPGP key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: Joe Tester
Name-Comment: with stupid passphrase
Name-Email: [email protected]
Expire-Date: 0
Passphrase: abc
%no-protection
%commit
%echo done
EOF
gpg2 --batch --gen-key $GNUPGHOME/foo
export SOPS_GPG_EXEC=$( which gpg2 )
export FP=$( gpg2 --with-colons --fingerprint | awk -F: '$1 == "fpr" {print $10; exit}' )
echo "Fingreprint: $FP ; gpg executable: $SOPS_GPG_EXEC"
# Run k8s related commands
kubectl create namespace sops
make install
sleep 3
sops -e -p $FP \
--encrypted-suffix='Templates' \
config/samples/isindir_v1alpha3_sopssecret.yaml \
> config/samples/isindir_v1alpha3_sopssecret.enc.yaml
file config/samples/isindir_v1alpha3_sopssecret.enc.yaml
echo "====================================="
cat config/samples/isindir_v1alpha3_sopssecret.enc.yaml
echo "====================================="
kubectl apply -f config/samples/isindir_v1alpha3_sopssecret.enc.yaml --namespace sops
sleep 3
nohup make run &
sleep 150
kubectl get sops --namespace sops
echo
kubectl get secrets --namespace sops
echo
export SECRETS_NUMBER=$( kubectl get secrets --namespace sops --no-headers \
| awk '$0 !~ /default-token/ { print $1; }' \
| wc -l )
if [[ $SECRETS_NUMBER -ne 5 ]]; then
echo "Expected number of secrets in sops namespace is 5 - Failed"
tail -40 nohup.out
exit 1
fi
# Check specific k8s for amount of data entries
## my-secret-name-0
export DATA_ENTRIES=$( kubectl get secrets my-secret-name-0 --namespace sops --no-headers \
| awk '{print $3}' )
if [[ $DATA_ENTRIES -ne 2 ]]; then
echo "Expected number of data entries in my-secret-name-0 is 2 - Failed"
tail -40 nohup.out
exit 1
fi
## my-secret-name-1
export DATA_ENTRIES=$( kubectl get secrets my-secret-name-1 --namespace sops --no-headers \
| awk '{print $3}' )
if [[ $DATA_ENTRIES -ne 3 ]]; then
echo "Expected number of data entries in my-secret-name-1 is 3 - Failed"
tail -40 nohup.out
exit 1
fi
## my-secret-name-2
export DATA_ENTRIES=$( kubectl get secrets my-secret-name-2 --namespace sops --no-headers \
| awk '{print $3}' )
if [[ $DATA_ENTRIES -ne 2 ]]; then
echo "Expected number of data entries in my-secret-name-2 is 2 - Failed"
tail -40 nohup.out
exit 1
fi
# Delete to check GC works
kubectl delete -f config/samples/isindir_v1alpha3_sopssecret.enc.yaml --namespace sops
sleep 15
kubectl get sops --namespace sops
echo
kubectl get secrets --namespace sops
echo
export SECRETS_NUMBER=$( kubectl get secrets --namespace sops \
| awk '$0!~/default-token/ && $0!~/NAME/ { print $1; }' \
| wc -l )
if [[ $SECRETS_NUMBER -ne 0 ]]; then
echo "Expected number of secrets in sops namespace is 0 - Failed"
exit 1
fi
rm -fr $GNUPGHOME
- name: Docker build
run: |
make docker-login
make docker-cross-build
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CONTROLLER_GEN_VERSION := "v0.14.0"
# https://github.com/kubernetes-sigs/controller-runtime/releases
CONTROLLER_RUNTIME_VERSION := "v0.16.3"
# https://github.com/kubernetes-sigs/kustomize/releases
KUSTOMIZE_VERSION := "v5.2.1"
KUSTOMIZE_VERSION := "v5.3.0"
# use `setup-envtest list` to obtain the list of available versions
# until fixed, can't use newer version, see:
# https://github.com/kubernetes-sigs/controller-runtime/issues/1571
Expand Down Expand Up @@ -240,8 +240,8 @@ setup-ginkgo: ## Download ginkgo locally
# go-install-tool will 'go install' any package $2 and install it to $1
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-install-tool
[ -f $(1) ] || { \
set -ex ;\
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cp -p .tool-versions $$TMP_DIR ;\
cd $$TMP_DIR ;\
Expand All @@ -259,8 +259,9 @@ define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cp -p .tool-versions $$TMP_DIR ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
$(GO) mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin $(GO) get $(2) ;\
rm -rf $$TMP_DIR ;\
Expand Down

0 comments on commit 0888e44

Please sign in to comment.