Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev container #140

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "ibm_zos_cics Devcontainer",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/common-utils:2": {}
},
"privileged": true,
"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"
},
"mounts" : [
"source=vscode-shell-history,target=/commandhistory,type=volume",
"source=${localEnv:HOME}/.ssh,target=/root/.ssh-local,type=bind,consistency=cached"
],
"customizations": {
"vscode": {
"extensions": [
"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"
]
}
}
}
}
42 changes: 42 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Copy contents to the .ssh directory
cp -r /root/.ssh-local/. /root/.ssh
if [ -e /root/.ssh/config ]; then
# If config file exists
mv ~/.ssh/config ~/.ssh/config-local
touch ~/.ssh/config
cat ~/.ssh/config-local > ~/.ssh/config
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

ansible-galaxy collection install ibm.ibm_zos_core:==1.9.1 -p /workspace/collections
ansible-galaxy collection install community.general -p /workspace/collections

echo -e "[defaults]\nstdout_callback=community.general.yaml\nCOLLECTIONS_PATHS=/workspace/collections" > ~/.ansible.cfg

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/"



# .zshrc file configuration - Use default zsh_theme
sed -i '/^ZSH_THEME/c\ZSH_THEME="robbyrussell"' ~/.zshrc
2 changes: 1 addition & 1 deletion tests/integration/variables/template.provisioning.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cics_install_path:
cpsm_data_set_path:
region_data_set_common: "{{ ansible_user }}.CICS.TESTS"
region_data_set_common: "{{ ansible_user | upper }}.CICS.TESTS"
region_data_set_unique:
region_data_set_path: "{{ region_data_set_common }}.{{ region_data_set_unique }}"
uss_path: "/u/{{ ansible_user | lower }}/{{ region_data_set_unique }}"
Expand Down
Loading