Skip to content

Commit

Permalink
Adopt community-ansible-dev-tools image (#1415)
Browse files Browse the repository at this point in the history
* adopt community-ansible-dev-tools EE

* Test fix for volume mounts

* fix setup script

* remove unused vars and instructions

* debug als tests on ci

* added ls command to check folder access

* setup tmate session only for linux

* Remove tmate session and revert unintended changes

---------

Co-authored-by: Ajinkya <ajinkyaudgirkar@gmail.com>
  • Loading branch information
priyamsahoo and audgirka authored Aug 20, 2024
1 parent 50c1dc4 commit f590e5b
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .config/Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ghcr.io/ansible/creator-ee:v24.2.0 as DEFAULT_EE
FROM ghcr.io/ansible/community-ansible-dev-tools:latest as DEFAULT_EE
# This file is updated by dependabot and used to determine not only which
# version of creator-ee we are supposed to use for testing execution
# version of community-ansible-dev-tools we are supposed to use for testing execution
# environments but also to dynamically retrieve the same set of constraints
# for testing outside execution environments.
2 changes: 2 additions & 0 deletions .config/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ mkdocstrings-python
pillow
pymdown-extensions
slugify
# for community-ansible-dev-tools image
ansible-pylibssh==1.1.0
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "ghcr.io/ansible/creator-ee:latest",
"image": "ghcr.io/ansible/community-ansible-dev-tools:latest",
"workspaceFolder": "/workspace",
"workspaceMount": "source=remote-workspace,target=/workspace,type=volume"
}
2 changes: 1 addition & 1 deletion docs/als/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Toggle usage of an execution environment
## [`ansible.executionEnvironment.image`](#executionEnvironment.image) { #executionEnvironment.image data-toc-label=executionEnvironment.image }
Name of the execution environment to be used
. Default value:
``ghcr.io/ansible/creator-ee:latest``
``ghcr.io/ansible/community-ansible-dev-tools:latest``

## [`ansible.executionEnvironment.pull.policy`](#executionEnvironment.pull.policy) { #executionEnvironment.pull.policy data-toc-label=executionEnvironment.pull.policy }
Image pull policy to be used. Valid values are &#x27;always&#x27;, &#x27;missing&#x27;, &#x27;never&#x27; and &#x27;tag&#x27;. always will always pull the image when extension is activated or reloaded. &#x27;missing&#x27; will pull if not locally available. &#x27;never&#x27; will never pull the image and &#x27;tag&#x27; will always pull if the image tag is &#x27;latest&#x27;, otherwise pull if not locally available.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@
"ansible.executionEnvironment.image": {
"scope": "resource",
"type": "string",
"default": "ghcr.io/ansible/creator-ee:latest",
"default": "ghcr.io/ansible/community-ansible-dev-tools:latest",
"markdownDescription": "Specify the name of the execution environment image.",
"order": 3
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ansible-language-server/.config/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM quay.io/ansible/creator-ee:v24.2.0 as DEFAULT_EE
FROM ghcr.io/ansible/community-ansible-dev-tools:latest as DEFAULT_EE
# This file is updated by dependabot and used to determine not only which
# version of creator-ee we are supposed to use for testing execution
# version of community-ansible-dev-tools we are supposed to use for testing execution
# environments but also to dynamically retrieve the same set of constraints
# for testing outside execution environments.
#
Expand Down
2 changes: 1 addition & 1 deletion packages/ansible-language-server/.config/requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# testing and linting, do not put version constraints here as they
# conflict with the locked version taken from creator-ee requirements.txt
# conflict with the locked version taken from community-ansible-dev-tools EE requirements.txt
ansible-core
ansible-lint
# end-of dependencies for which we allow pre-releases
Expand Down
2 changes: 1 addition & 1 deletion packages/ansible-language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"watch": "tsc --watch -p .",
"test": "sh -c \"nyc mocha ${MOCHA_OPTS:-}\"",
"test-with-ee": "sh -c \"nyc mocha --grep @ee ${MOCHA_OPTS:-}\"",
"test-without-ee": "sh -c \"nyc mocha --grep @ee --invert ${MOCHA_OPTS:-}\""
"test-without-ee": "sh -c \"SKIP_PODMAN=1 SKIP_DOCKER=1 nyc mocha --grep @ee --invert ${MOCHA_OPTS:-}\""
},
"all": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SettingsManager {
description: "Toggle usage of an execution environment",
},
image: {
default: "ghcr.io/ansible/creator-ee:latest",
default: "ghcr.io/ansible/community-ansible-dev-tools:latest",
description: "Name of the execution environment to be used",
},
pull: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ansible-language-server/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ try {
}

const containers = new Set([
`ghcr.io/ansible/creator-ee:${EE_VERSION}`,
`ghcr.io/ansible/community-ansible-dev-tools:${EE_VERSION}`,
DEFAULT_CONTAINER,
]);

Expand Down
5 changes: 4 additions & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export class SettingsManager {
enabled: eeSettings.get("enabled", false),
containerEngine: eeSettings.get("containerEngine", "auto"),
containerOptions: eeSettings.get("containerOptions", ""),
image: eeSettings.get("image", "ghcr.io/ansible/creator-ee:latest"),
image: eeSettings.get(
"image",
"ghcr.io/ansible/community-ansible-dev-tools:latest",
),
pull: {
arguments: eeSettings.get("pull.arguments", ""),
policy: eeSettings.get("pull.policy", "missing"),
Expand Down
4 changes: 2 additions & 2 deletions test/testFixtures/hover/with_ee/1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
ansible.builtin.debug:
msg:

- name: Collection module present in creator-ee
- name: Collection module present in community-ansible-dev-tools EE
ansible.posix.patch:
src: /tmp/index.html.patch
dest: /var/www/index.html

- name: Collection module not present in creator-ee
- name: Collection module not present in community-ansible-dev-tools EE
vyos.vyos.vyos_prefix_lists:
config:
- prefix_lists:
Expand Down
2 changes: 1 addition & 1 deletion test/testFixtures/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"ansible.executionEnvironment.containerEngine": "docker",
"ansible.executionEnvironment.containerOptions": "",
"ansible.executionEnvironment.enabled": false,
"ansible.executionEnvironment.image": "ghcr.io/ansible/creator-ee:latest",
"ansible.executionEnvironment.image": "ghcr.io/ansible/community-ansible-dev-tools:latest",
"ansible.executionEnvironment.pull.policy": "missing",
"ansible.executionEnvironment.pull.arguments": "",
"ansible.executionEnvironment.volumeMounts": [],
Expand Down
25 changes: 14 additions & 11 deletions tools/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
set -euo pipefail

IMAGE_VERSION=$(./tools/get-image-version)
IMAGE=ghcr.io/ansible/creator-ee:${IMAGE_VERSION}
IMAGE=ghcr.io/ansible/community-ansible-dev-tools:${IMAGE_VERSION}
PIP_LOG_FILE=out/log/pip.log
ERR=0
EE_ANSIBLE_VERSION=null
Expand Down Expand Up @@ -289,11 +289,11 @@ python3 -m pip check || {
}

if [[ $(uname || true) != MINGW* ]]; then # if we are not on pure Windows
# We used the already tested constraints file from creator-ee in order
# to avoid surprises. This ensures venv and creator-ee have exactly same
# We used the already tested constraints file from community-ansible-dev-tools EE in order
# to avoid surprises. This ensures venv and community-ansible-dev-tools EE have exactly same
# versions.
python3 -m pip install -q \
-r "https://raw.githubusercontent.com/ansible/creator-ee/${IMAGE_VERSION}/_build/requirements.txt" -r .config/requirements.in
-r .config/requirements.in
fi

# GHA failsafe only: ensure ansible and ansible-lint cannot be found anywhere
Expand Down Expand Up @@ -379,10 +379,12 @@ if [[ "${DOCKER_VERSION}" != 'null' ]] && [[ "${SKIP_DOCKER:-}" != '1' ]]; then
EE_ANSIBLE_VERSION=$(get_version \
docker run --rm "${IMAGE}" ansible --version)
EE_ANSIBLE_LINT_VERSION=$(get_version \
docker run --rm "${IMAGE}" ansible-lint --nocolor --version)
# Test podman ability to mount current folder with write access, default mount options
docker run --rm -v "$PWD:$PWD" ghcr.io/ansible/creator-ee:latest \
bash -c "[ -w $PWD ] && echo 'Mounts working' || { echo 'Mounts not working. You might need to either disable or make selinux permissive.'; exit 1; }"
docker run "${IMAGE}" ansible-lint --nocolor --version)
log notice "ansible: ${EE_ANSIBLE_VERSION}, ansible-lint: ${EE_ANSIBLE_LINT_VERSION}"
# Test docker ability to mount current folder with write access, default mount options
docker run -v "$PWD:$PWD" ghcr.io/ansible/community-ansible-dev-tools:latest \
bash -c "[ -e $PWD ] && [ -d $PWD ] \
&& echo 'Mounts working' || { echo 'Mounts not working. You might need to either disable or make selinux permissive.'; exit 1; }"
fi

log notice "Podman checks..."
Expand Down Expand Up @@ -442,9 +444,10 @@ if [[ "${PODMAN_VERSION}" != 'null' ]] && [[ "${SKIP_PODMAN:-}" != '1' ]]; then
log notice "Retrieving ansible-lint version from ee"
EE_ANSIBLE_LINT_VERSION=$(get_version \
podman run --rm "${IMAGE}" ansible-lint --nocolor --version)
log notice "ansible: ${EE_ANSIBLE_VERSION}, ansible-lint: ${EE_ANSIBLE_LINT_VERSION}"
log notice "Test podman ability to mount current folder with write access, default mount options"
podman run --rm -v "$PWD:$PWD" ghcr.io/ansible/creator-ee:latest \
bash -c "[ -w $PWD ] && echo 'Mounts working' || { echo 'Mounts not working. You might need to either disable or make selinux permissive.'; exit 1; }"
podman run -v "$PWD:$PWD" ghcr.io/ansible/community-ansible-dev-tools:latest \
bash -c "[ -e $PWD ] && [ -d $PWD ] && echo 'Mounts working' || { echo 'Mounts not working. You might need to either disable or make selinux permissive.'; exit 1; }"
fi

if [[ -f "/usr/bin/apt-get" ]]; then
Expand Down Expand Up @@ -487,7 +490,7 @@ tools:
containers:
podman: ${PODMAN_VERSION}
docker: ${DOCKER_VERSION}
creator-ee:
community-ansible-dev-tools:
ansible: ${EE_ANSIBLE_VERSION}
ansible-lint: ${EE_ANSIBLE_LINT_VERSION}
EOF
Expand Down

0 comments on commit f590e5b

Please sign in to comment.