Skip to content
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
1 change: 1 addition & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ endgroup
gunicorn
libera
libonig
lightspeed
microdnf
mknod
modifyitems
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
devspaces
devel
ee-amd64:tox -e ee:runner=devtools-multiarch-builder
ee-arm64:tox -e ee:runner=ubuntu-24.04-arm64-2core
ee-arm64:tox -e ee:runner=ubuntu-24.04-arm
selenium-amd64:tox -e selenium:runner=devtools-multiarch-builder
selenium-arm64:tox -e selenium:runner=ubuntu-24.04-arm
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners
secrets: inherit # needed for logging to the ghcr.io registry

codeql:
Expand Down Expand Up @@ -82,9 +85,17 @@ jobs:
with:
category: "/language:${{matrix.language}}"

publish-ee:
publish-image:
# environment: release # approval
runs-on: ubuntu-24.04
name: publish-${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image:
- ee
- selenium

needs:
- tox
if: github.ref == 'refs/heads/main' || (github.event_name == 'release' && github.event.action == 'published')
Expand All @@ -97,7 +108,7 @@ jobs:
- name: pull-merge-push for the the two arch images under a single manifest
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: ./tools/ee.sh --publish "${{ github.event.release.tag_name || github.sha }}" "${{ (github.event_name == 'release' && github.event.action == 'published') || '--dry' }}"
run: ./tools/${{ matrix.image }}.sh --publish "${{ github.event.release.tag_name || github.sha }}" "${{ (github.event_name == 'release' && github.event.action == 'published') || '--dry' }}"

publish-devspaces:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -189,7 +200,7 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'
needs:
- publish-wheel
- publish-ee
- publish-image
- publish-devspaces
runs-on: ubuntu-24.04

Expand Down
2 changes: 2 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ignorePaths:
- mkdocs.yml
- pyproject.toml
- tox.ini
- selenium/Containerfile
- selenium/init.go

languageSettings:
- languageId: python
Expand Down
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,16 @@ editable = true
extras = ["server"]
skip_install = false

[tool.tox.env.selenium]
commands = [["python", "-m", "build", "--version"], ["./tools/selenium.sh"]]
commands_post = [["./tools/cleanup.sh"]]
commands_pre = []
dependency_groups = ["ee", "dev"]
description = "Build the selenium-adt container image"
editable = true
extras = ["server"]
skip_install = false

[tool.tox.env.lint]
commands = [["pre-commit", "run", "--all-files", "--show-diff-on-failure"]]
commands_post = []
Expand Down Expand Up @@ -603,7 +613,8 @@ allowlist_externals = [
"sh",
"./tools/cleanup.sh",
"./tools/devspaces.sh",
"./tools/ee.sh"
"./tools/ee.sh",
"./tools/selenium.sh"
]
commands = [
["sh", "-c", "ansible --version | head -n 1"],
Expand Down
166 changes: 166 additions & 0 deletions selenium/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
FROM registry.fedoraproject.org/fedora:43 AS selenium-atd
LABEL maintainer="ansible-devtools@redhat.com"

COPY init.go .

COPY settings.json /home/selenium/.local/share/code-server/User/settings.json

# Firefox releases
# https://download-installer.cdn.mozilla.net/pub/firefox/releases/
ARG FIREFOX_URL="https://download-installer.cdn.mozilla.net/pub/firefox/releases/140.7.0esr/linux-x86_64/en-US/firefox-140.7.0esr.tar.xz"
# Gecko driver releases
# https://github.com/mozilla/geckodriver/releases
ARG GECKODRIVER_VERSION="v0.36.0"
# Chrome versions
# https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
ARG CHROME_VERSION="144.0.7559.59-1"

ARG SELENIUM_MAJOR_VERSION=4

ARG SELENIUM_MINOR_VERSION=39

ARG SELENIUM_PATCH_VERSION=0

ENV SELENIUM_HOME=/home/selenium

ENV SELENIUM_PORT=4444 \
SELENIUM_SESSION_TIMEOUT=1800 \
VNC_PORT=5999 \
API_PORT=8000 \
DISPLAY=:99 \
DBUS_SESSION_BUS_ADDRESS=/dev/null \
HOME=${SELENIUM_HOME} \
VNC_GEOMETRY="1600x900" \
SELENIUM_VERSION=${SELENIUM_MAJOR_VERSION}.${SELENIUM_MINOR_VERSION}.${SELENIUM_PATCH_VERSION} \
SELENIUM_PATH=${SELENIUM_HOME}/selenium-server/selenium-server-standalone.jar \
SELENIUM_HTTP_JDK_CLIENT_PATH=${SELENIUM_HOME}/selenium-server/selenium-http-jdk-client.jar \
PATH=${SELENIUM_HOME}/firefox:/opt/google/chrome:${PATH}

EXPOSE ${SELENIUM_PORT}

EXPOSE ${VNC_PORT}

EXPOSE ${API_PORT}

WORKDIR ${SELENIUM_HOME}

RUN PACKAGES="\
alsa-lib \
at-spi2-atk \
at-spi2-core \
atk \
avahi-libs \
bzip2 \
cairo \
cairo-gobject \
cups-libs \
dbus-glib \
dbus-libs \
expat \
fluxbox \
fontconfig \
freetype \
fribidi \
gdk-pixbuf2 \
graphite2 \
gtk3 \
go \
harfbuzz \
imlib2 \
java-latest-openjdk-headless \
jq \
libcloudproviders \
libdatrie \
libdrm \
libepoxy \
liberation-fonts \
liberation-fonts-common \
liberation-mono-fonts \
liberation-sans-fonts \
liberation-serif-fonts \
libfontenc \
libglvnd \
libglvnd-glx \
libICE \
libjpeg-turbo \
libpng \
libSM \
libthai \
libwayland-client \
libwayland-cursor \
libwayland-egl \
libwayland-server \
libwebp \
libX11 \
libX11-common \
libX11-xcb \
libXau \
libxcb \
libXcomposite \
libXcursor \
libXdamage \
libXdmcp \
libXext \
libXfixes \
libXfont2 \
libXft \
libXi \
libXinerama \
libxkbcommon \
libxkbfile \
libXpm \
libXrandr \
libXrender \
libXtst \
libxshmfence \
libXt \
mesa-libgbm \
nspr \
nss \
nss-softokn \
nss-softokn-freebl \
nss-util \
nss-tools \
nss-sysinit \
pango \
pixman \
tar \
tigervnc-server-minimal \
tzdata-java \
unzip \
vulkan-loader \
wget \
xdg-utils \
xkbcomp \
xkeyboard-config" && \
microdnf -q -y install ${PACKAGES} >/dev/null
# ^ https://github.com/rpm-software-management/dnf5/issues/570

RUN mkdir -p .cache/dconf .mozilla/plugins .vnc/ .fluxbox/ && \
echo "session.screen0.toolbar.autoHide: true" > .fluxbox/init && \
touch .Xauthority .vnc/config && \
mkdir -p ${SELENIUM_HOME}/selenium-server && \
curl -L https://github.com/SeleniumHQ/selenium/releases/download/selenium-${SELENIUM_MAJOR_VERSION}.${SELENIUM_MINOR_VERSION}.0/selenium-server-${SELENIUM_VERSION}.jar \
-o ${SELENIUM_PATH} && \
curl -L https://repo1.maven.org/maven2/org/seleniumhq/selenium/selenium-http-jdk-client/${SELENIUM_VERSION}/selenium-http-jdk-client-${SELENIUM_VERSION}.jar \
-o ${SELENIUM_HTTP_JDK_CLIENT_PATH} && \
curl -L https://download-installer.cdn.mozilla.net/pub/firefox/releases/140.7.0esr/linux-x86_64/en-US/firefox-140.7.0esr.tar.xz|tar --xz -x && \
curl -LO https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz && \
tar -C /usr/bin/ -xvf geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz && \
rm -f geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz && \
curl -fsSL https://code-server.dev/install.sh | sh && \
code-server --install-extension ms-python.vscode-python-envs --install-extension redhat.vscode-yaml --install-extension redhat.vscode-redhat-account && \
mkdir -p workspace && touch workspace/playbook.yaml && \
modutil -fips true -dbdir /etc/pki/nssdb -force && \
chown -R 0:0 /etc/pki/nssdb && \
chmod 644 /etc/pki/nssdb/* && \
chown -R 1001:0 ${SELENIUM_HOME} && \
chmod -R g=u ${SELENIUM_HOME}

USER 1001

# install packages needed for go file
RUN go vet /init.go

# run init.go to start all process in order
CMD ["sh", "-c", "go run /init.go" ]
32 changes: 32 additions & 0 deletions selenium/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# selenium-atd container

This container has selenium and vscode server in addition to 'adt' tools and
is used for testing vscode-ansible extension.

```bash
docker build -t {name} -f Dockerfile .
```

or

```bash
podman build -t {name} -f Dockerfile .
```

To run it:

```bash
docker run -it --shm-size=2g -p 4444:4444 -p 5999:5999 {name}
```

Alternatively, a pre built image can be pulled from quay:

```bash
docker run -it --shm-size=2g -p 4444:4444 -p 5999:5999 ghcr.io/ansible/selenium-adt
```

When the container starts, it will automatically start all the needed services.

You can connect to the container using a vnc client on port 5999 and see what
happens in the container the vs-code server runs on port 8080 and selenium runs
on port 4444
Loading
Loading