-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5c8aad
commit 92efbbf
Showing
5 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM public.ecr.aws/ubuntu/ubuntu:23.04_stable | ||
|
||
SHELL ["/usr/bin/env", "-S", "bash", "-cl"] | ||
|
||
RUN apt-get update -q && apt-get install -y git curl python3 python3-pip && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN adduser --uid 999 --shell /bin/bash --home /home/argocd --disabled-password argocd | ||
ENV PATH="${PATH}:/asdf/.asdf/shims:/asdf/.asdf/bin" | ||
|
||
USER argocd | ||
WORKDIR /home/argocd | ||
|
||
RUN git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf && \ | ||
echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc && \ | ||
echo '. $HOME/.asdf/asdf.sh' >> $HOME/.profile | ||
|
||
RUN asdf plugin add kustomize && \ | ||
asdf plugin add helm && \ | ||
asdf plugin add krm-function https://github.com/imranismail/asdf-krm-function.git && \ | ||
asdf install kustomize latest && \ | ||
asdf global kustomize latest && \ | ||
asdf install helm latest && \ | ||
asdf global helm latest | ||
|
||
COPY plugin /usr/local/bin/ | ||
COPY plugin.yaml ./cmp-server/config/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.PHONY: build | ||
build: | ||
@docker build -t ghcr.io/imranismail/asdf-krm-function --platform linux/amd64 . | ||
.PHONY: push | ||
push: | ||
@docker push ghcr.io/imranismail/asdf-krm-function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env -S bash -l | ||
|
||
set -euo pipefail | ||
|
||
init_asdf() { | ||
# if no .tool-versions found return function early | ||
if [[ ! -f ".tool-versions" ]]; then | ||
return | ||
fi | ||
|
||
echo "Initializing asdf..." | ||
|
||
# try to install additional tools | ||
error=$(asdf install) | ||
errorcode=$? | ||
|
||
# if there are missing plugins, install them and try again | ||
if [[ $errorcode -ne 0 ]]; then | ||
case $error in | ||
*"plugin is not installed"*) | ||
missing_plugins=$(echo "$error" | awk '{ print $1 }') | ||
|
||
for plugin in $missing_plugins; do | ||
asdf plugin add "$plugin" | ||
done | ||
|
||
asdf install | ||
;; | ||
*) | ||
echo "Error installing dependencies: $error" | ||
exit 1 | ||
;; | ||
esac | ||
fi | ||
|
||
echo "asdf initialization complete" | ||
} | ||
|
||
init_python() { | ||
if [[ ! -f "requirements.txt" ]]; then | ||
return | ||
fi | ||
|
||
echo "Initializing python..." | ||
pip install -r requirements.txt | ||
echo "Python initialization complete" | ||
} | ||
|
||
init() { | ||
init_asdf | ||
init_python | ||
} | ||
|
||
generate() { | ||
kustomize build --enable-alpha-plugins --enable-exec --load-restrictor LoadRestrictionsNone | ||
} | ||
|
||
main() { | ||
case "$1" in | ||
"init") | ||
init | ||
;; | ||
"generate") | ||
generate | ||
;; | ||
*) | ||
echo "Unknown command: $1" | ||
echo "Usage: $0 <init|generate>" | ||
echo "" | ||
echo "init: install dependencies" | ||
echo "generate: generate kustomize output" | ||
exit 1 | ||
;; | ||
esac | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ConfigManagementPlugin | ||
metadata: | ||
name: asdf-kustomize | ||
spec: | ||
init: | ||
command: [plugin] | ||
args: [init] | ||
generate: | ||
command: [plugin] | ||
args: [generate] | ||
preserveFileMode: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env -S bash -l | ||
|
||
set -euo pipefail | ||
|
||
init_asdf() { | ||
# if no .tool-versions found return function early | ||
if [[ ! -f ".tool-versions" ]]; then | ||
return | ||
fi | ||
|
||
echo "Initializing asdf..." | ||
|
||
# try to install additional tools | ||
error=$(asdf install) | ||
errorcode=$? | ||
|
||
# if there are missing plugins, install them and try again | ||
if [[ $errorcode -ne 0 ]]; then | ||
case $error in | ||
*"plugin is not installed"*) | ||
missing_plugins=$(echo "$error" | awk '{ print $1 }') | ||
|
||
for plugin in $missing_plugins; do | ||
asdf plugin add "$plugin" | ||
done | ||
|
||
asdf install | ||
;; | ||
*) | ||
echo "Error installing dependencies: $error" | ||
exit 1 | ||
;; | ||
esac | ||
fi | ||
|
||
echo "asdf initialization complete" | ||
} | ||
|
||
init_python() { | ||
if [[ ! -f "requirements.txt" ]]; then | ||
return | ||
fi | ||
|
||
echo "Initializing python..." | ||
pip install -r requirements.txt | ||
echo "Python initialization complete" | ||
} | ||
|
||
init() { | ||
init_asdf | ||
init_python | ||
} | ||
|
||
generate() { | ||
kustomize build --enable-alpha-plugins --enable-exec --load-restrictor LoadRestrictionsNone | ||
} | ||
|
||
main() { | ||
case "$1" in | ||
"init") | ||
init | ||
;; | ||
"generate") | ||
generate | ||
;; | ||
*) | ||
echo "Unknown command: $1" | ||
echo "Usage: $0 <init|generate>" | ||
echo "" | ||
echo "init: install dependencies" | ||
echo "generate: generate kustomize output" | ||
exit 1 | ||
;; | ||
esac | ||
} | ||
|
||
main "$@" |