From 48ca9770465f611522bbafa35158c7336f984966 Mon Sep 17 00:00:00 2001 From: Thomas Latham Date: Wed, 30 Oct 2024 08:44:01 +0000 Subject: [PATCH] Devcontainer - Change Ansible to 2.16 and fix CMCI int test issue --- .devcontainer/devcontainer.json | 19 ++++--------------- .devcontainer/setup.sh | 22 +++++++++------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c367727..8f4a5dc 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,10 +9,8 @@ "remoteUser": "root", "workspaceMount": "source=${localWorkspaceFolder},target=/workspace/collections/ansible_collections/ibm/ibm_zos_cics,type=bind", "workspaceFolder": "/workspace/collections", - "postAttachCommand": "bash /workspace/collections/ansible_collections/ibm/ibm_zos_cics/.devcontainer/setup.sh", - "postCreateCommand": { - "gitMarkSafe": "git config --global --add safe.directory /workspaces/collections/ansible_collections/ibm/ibm_zos_cics" - }, + "postAttachCommand": "bash /workspace/collections/ansible_collections/ibm/ibm_zos_cics/.devcontainer/setup.sh", + "initializeCommand": "eval \"$(ssh-agent -s)\" > /dev/null && grep -slR \"PRIVATE\" ~/.ssh | xargs ssh-add", "mounts" : [ "source=vscode-shell-history,target=/commandhistory,type=volume", "source=${localEnv:HOME}/.ssh,target=/root/.ssh-local,type=bind,consistency=cached" @@ -23,17 +21,8 @@ "redhat.ansible", "ms-python.python", "eamodio.gitlens", - "charliermarsh.ruff" - ], - "settings": { - "extensions.verifySignature": false, - "ruff.format.args": [ - "--config=/workspace/collections/ansible_collections/ibm/ibm_zos_cics/.devcontainer/pyproject.toml" - ], - "ruff.lint.args": [ - "--config=/workspace/collections/ansible_collections/ibm/ibm_zos_cics/.devcontainer/pyproject.toml" - ] - } + "ms-vsliveshare.vsliveshare" + ] } } } \ No newline at end of file diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 821d42c..ee95210 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -9,12 +9,7 @@ if [ -e /root/.ssh/config ]; then rm ~/.ssh/config-local fi -eval "$(ssh-agent)" -ssh-add - -python_ver=$(python -c 'import platform; major, minor, patch = platform.python_version_tuple(); print("{0}.{1}".format(major,minor))') - -python3 -m pip install --user ansible-core==2.17.4 +python3 -m pip install --user ansible-core==2.16 ansible-galaxy collection install ibm.ibm_zos_core:==1.9.1 -p /workspace/collections ansible-galaxy collection install community.general -p /workspace/collections @@ -24,17 +19,18 @@ echo -e "[defaults]\nstdout_callback=community.general.yaml\nCOLLECTIONS_PATHS=/ pip install -r /workspace/collections/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt pip install -r /workspace/collections/ansible_collections/ibm/ibm_zos_cics/doc-requirements.txt -# Remove additional pythons from bin so we can use shorthand ansible commands -find /usr/bin/python* -type f -not -name python"${python_ver}" -exec rm -v {} + - mkdir -p /commandhistory touch /commandhistory/.zsh_history chown -R root /commandhistory -echo "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.zsh_history" >> "/root/.zshrc" -#Make this ansible_cics_collection repo the default repo when opening a new zsh terminal or running 'cd' -echo "cd /workspace/collections/ansible_collections/ibm/ibm_zos_cics/" >> "/root/.zshrc" -echo "export HOME=/workspace/collections/ansible_collections/ibm/ibm_zos_cics/" +{ + # Add history to zsh shell + echo "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.zsh_history" + + # Make this ansible_cics_collection repo the default repo when opening a new zsh terminal + echo "cd /workspace/collections/ansible_collections/ibm/ibm_zos_cics/" + echo "git config --global --add safe.directory /workspaces/collections/ansible_collections/ibm/ibm_zos_cics" +} >> "/root/.zshrc"