diff --git a/.gitignore b/.gitignore index 2110cd79..3c67b7e1 100644 --- a/.gitignore +++ b/.gitignore @@ -187,3 +187,4 @@ devspaces/context/setup-image.sh final/context/setup-image.sh final/setup-image.sh image.tar +final/.ohmyposh.omp.json diff --git a/.ohmyposh.omp.json b/.ohmyposh.omp.json new file mode 100644 index 00000000..9a17c78a --- /dev/null +++ b/.ohmyposh.omp.json @@ -0,0 +1,162 @@ +{ + "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", + "console_title_template": "{{.Folder}}{{if .Root}} :: root{{end}}", + "palette": { + "yellow": "#c6c43f", + "lightYellow": "#eae14a" + }, + "blocks": [ + { + "type": "prompt", + "alignment": "left", + "segments": [ + { + "properties": { + "cache_duration": "none", + "mapped_shell_names": { + "bash": "Bash", + "cmd": "Cmd", + "powershell": "Shell", + "pwsh": "Shell" + } + }, + "template": "@{{ .HostName }}", + "foreground": "darkGray", + "type": "shell", + "style": "plain" + }, + { + "properties": { + "cache_duration": "1h", + "mapped_shell_names": { + "bash": "Bash", + "cmd": "Cmd", + "powershell": "Shell", + "pwsh": "Shell" + } + }, + "template": "{{ if ne .OS \"darwin\" }} {{ .OS }}{{ end }}{{ if .WSL }}-wsl{{ end }}", + "foreground": "cyan", + "type": "shell", + "style": "plain" + }, + { + "properties": { + "cache_duration": "none", + "display_mode": "context", + "fetch_virtual_env": true, + "home_enabled": true, + "display_default": true, + "folder_name_fallback": true, + "default_venv_names": [] + }, + "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}({{ .Venv }}) {{ end }}{{ .Full }}{{ end }}", + "foreground": "yellow", + "powerline_symbol": "\ue0b0", + "type": "python", + "style": "plain" + }, + { + "properties": { + "branch_icon": "", + "branch_max_length": 25, + "cache_duration": "none", + "fetch_stash_count": true, + "fetch_status": true, + "fetch_upstream_icon": true, + "cherry_pick_icon": "\u2713 ", + "commit_icon": "\u25b7 ", + "merge_icon": "\u25f4 ", + "no_commits_icon": "[no commits]", + "rebase_icon": "\u2c62 ", + "tag_icon": "\u25b6 " + }, + "template": " {{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} § {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} {{ .Staging.String }}{{ end }} ", + "foreground": "#F3C267", + "type": "git", + "style": "plain", + "foreground_templates": [ + "{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}", + "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff5a5a{{ end }}", + "{{ if gt .Ahead 0 }}#B388FF{{ end }}", + "{{ if gt .Behind 0 }}#B388FF{{ end }}" + ] + } + ], + "newline": false + }, + { + "type": "prompt", + "alignment": "left", + "segments": [ + { + "properties": { + "cache_duration": "none" + }, + "template": " {{ .Code }} ({{ reason .Code }})", + "foreground": "#b8ff75", + "type": "status", + "style": "plain", + "foreground_templates": ["{{ if gt .Code 0 }}#E06C75{{ end }}"] + }, + { + "properties": { + "always_enabled": false, + "cache_duration": "none", + "style": "roundrock", + "threshold": 5000 + }, + "template": " {{ .FormattedMs }}{{ if gt .Ms 10000 }}\u0007{{ end }} ", + "foreground": "lightYellow", + "type": "executiontime", + "style": "plain", + "foreground_templates": ["{{ if gt .Code 0 }}#E06C75{{ end }}"] + } + ] + }, + { + "type": "prompt", + "alignment": "left", + "segments": [ + { + "properties": { + "cache_duration": "none", + "style": "full" + }, + "template": "{{ .Path }}", + "foreground": "#61AFEF", + "type": "path", + "style": "plain" + } + ], + "newline": false + }, + { + "type": "prompt", + "alignment": "left", + "segments": [ + { + "properties": { + "cache_duration": "none" + }, + "template": "!", + "foreground": "#E06C75", + "type": "root", + "style": "plain" + }, + { + "properties": { + "cache_duration": "none" + }, + "template": "❯", + "foreground": "#E06C75", + "type": "text", + "style": "plain" + } + ], + "newline": true + } + ], + "version": 3, + "final_space": true +} diff --git a/bindep.txt b/bindep.txt index 8b64e4b8..30040f54 100644 --- a/bindep.txt +++ b/bindep.txt @@ -1,3 +1,4 @@ python3-devel [platform:redhat] oniguruma-devel [test platform:rpm] libonig-dev [test platform:dpkg] +unzip [platform:redhat] diff --git a/devspaces/context/setup.sh b/devspaces/context/setup.sh index fac43821..a11eea4b 100755 --- a/devspaces/context/setup.sh +++ b/devspaces/context/setup.sh @@ -24,6 +24,7 @@ dnf install -y -q \ "python${PYV}-pyyaml" \ "python${PYV}-wheel" \ tar \ + unzip \ util-linux-user \ which \ zsh \ diff --git a/final/setup.sh b/final/setup.sh index c68fc783..fac10c7d 100755 --- a/final/setup.sh +++ b/final/setup.sh @@ -22,32 +22,34 @@ microdnf remove -y subscription-manager dnf-plugin-subscription-manager # gcc: for ansible-pylibssh, onigurumacffi/arm64 # ncurses: for ansible-navigator # oniguruma-devel: onigurumacffi/arm64 (does not have binary) +# unzip: oh-my-posh installer microdnf install -q -y \ -tar \ +dumb-init \ echo \ -podman \ fuse-overlayfs \ -openssh-clients \ -zsh \ -util-linux-user \ -which \ -git \ -nano \ -vim \ -dumb-init \ gcc \ +git \ git-core \ libssh-devel \ -python3-markupsafe \ +nano \ ncurses \ oniguruma-devel \ +openssh-clients \ +podman \ python3-bcrypt \ python3-cffi \ python3-devel \ +python3-markupsafe \ python3-pip \ python3-pyyaml \ python3-ruamel-yaml \ python3-wheel \ +tar \ +unzip \ +util-linux-user \ +vim \ +which \ +zsh \ --exclude container-selinux microdnf -q clean all diff --git a/tools/devspaces.sh b/tools/devspaces.sh index edc64f2f..5edd3598 100755 --- a/tools/devspaces.sh +++ b/tools/devspaces.sh @@ -18,6 +18,7 @@ fi rm -f devspaces/context/*.whl ln -f dist/*.whl devspaces/context ln -f tools/setup-image.sh devspaces/context +ln -f .ohmyposh.omp.json devspaces/context # we force use of linux/amd64 platform because source image supports only this # platform and without it, it will fail to cross-build when task runs on arm64. diff --git a/tools/ee.sh b/tools/ee.sh index 17409c72..c6bddae5 100755 --- a/tools/ee.sh +++ b/tools/ee.sh @@ -66,6 +66,7 @@ python -m build --outdir "$REPO_DIR/final/dist/" --wheel "$REPO_DIR" ansible-builder create -f execution-environment.yml --output-filename Containerfile -v3 $BUILD_CMD -f context/Containerfile context/ --tag "${TAG_BASE}" ln -f tools/setup-image.sh final/ +ln -f .ohmyposh.omp.json final/ $BUILD_CMD -f final/Containerfile final/ --tag "${IMAGE_NAME}" # We save local image in order to import it inside the container later for c-in-c testing diff --git a/tools/setup-image.sh b/tools/setup-image.sh index ee3565db..d1adf406 100755 --- a/tools/setup-image.sh +++ b/tools/setup-image.sh @@ -15,5 +15,13 @@ oc version --client=true # ubi9 image but not on fedora one. touch ~/.zshrc -# Install oh-my-zsh -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended +# Install our oh-my-posh theme +mkdir -p ~/.poshthemes/ +cp -f /final/.ohmyposh.omp.json ~/.poshthemes/ansible.omp.json + +# Install oh-my-posh +curl -s https://ohmyposh.dev/install.sh | bash -s +cat >> ~/.zshrc <<'EOF' +export PATH=$PATH:$HOME/.local/bin +eval "$(oh-my-posh init zsh --config ~/.poshthemes/ansible.omp.json)" +EOF