Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Make container definition compatible with dependabot (#617)
Browse files Browse the repository at this point in the history
* Improve test-setup.sh for macos

- discover broken virtualens (after python upgrade)
- implement workaround for building ansible-pylibssh

Related: ansible/pylibssh#207

* Make dockerfile dependabot compatible

See dependabot/dependabot-core#6067
  • Loading branch information
ssbarnea authored Jan 21, 2024
1 parent 430cec5 commit be91984
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .config/Containerfile → .config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ FROM quay.io/ansible/creator-ee:v0.21.0 as DEFAULT_EE
# version of creator-ee we are supposed to use for testing execution
# environments but also to dynamically retrieve the same set of constraints
# for testing outside execution environments.
#
# Do not rename this file to Containerfile due to
# https://github.com/dependabot/dependabot-core/issues/6067
4 changes: 3 additions & 1 deletion .config/dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Ansible
CFLAGS
Containerfile
Dpkg
FQCN
Expand Down Expand Up @@ -58,8 +59,10 @@ lineinfile
linkcheck
linkify
loglevel
lssh
lxml
markdownlint
mkdocs
monospace
mycollection
mymodule
Expand Down Expand Up @@ -118,7 +121,6 @@ wordwrap
workdir
xvfb
yammlint
mkdocs

# names and usernames:
Ganesh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles(
'package.json',
'package-lock.json',
'.config/Containerfile'
'.config/Dockerfile'
) }}
- name: Enable caching for podman-machine
Expand All @@ -130,7 +130,7 @@ jobs:
path: |
~/.local/share/containers
~/.config/containers
key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/Containerfile', '**/Taskfile.yml', 'tools/*.*') }}
key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/Dockerfile', '**/Taskfile.yml', 'tools/*.*') }}

- name: Install Task
if: "!contains(matrix.shell, 'wsl')"
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ repos:
- id: shellcheck
args:
- --color=always
- -e
- SC1091
- repo: local
hooks:
- id: npm-ci
Expand Down Expand Up @@ -52,7 +54,7 @@ repos:
files: "codecov.yml"
pass_filenames: false
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.2.1
rev: v8.3.0
hooks:
- id: cspell
name: Spell check with cspell
Expand Down Expand Up @@ -103,7 +105,7 @@ repos:
docs/settings.md
$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-alpha.0
rev: v9.0.0-alpha.1
hooks:
- id: eslint
args:
Expand Down
2 changes: 1 addition & 1 deletion tools/get-image-version
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
version = "latest"
# read image version from dockerfile
with open(".config/Containerfile", "r") as f:
with open(".config/Dockerfile", "r") as f:
for line in f:
if line.startswith("FROM"):
version = line.split()[1].split()[0].split(":")[1]
Expand Down
20 changes: 18 additions & 2 deletions tools/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,32 @@ if [[ ! -d "${VIRTUAL_ENV}" ]]; then
log notice "Creating virtualenv ..."
python3 -m venv "${VIRTUAL_ENV}"
fi
# shellcheck disable=SC1091
# shellcheck source=/dev/null
. "${VIRTUAL_ENV}/bin/activate"

if [[ "$(which python3)" != ${VIRTUAL_ENV}/bin/python3 ]]; then
log warning "Virtualenv broken, trying to recreate it ..."
python3 -m venv --clear "${VIRTUAL_ENV}"
. "${VIRTUAL_ENV}/bin/activate"
if [[ "$(which python3)" != ${VIRTUAL_ENV}/bin/python3 ]]; then
log error "Virtualenv still broken."
exit 99
fi
fi
log notice "Upgrading pip ..."

python3 -m pip install -q -U pip

EE_VERSION=$(./tools/get-image-version)
if [[ $(uname || true) != MINGW* ]]; then # if we are not on pure Windows
URL="https://raw.githubusercontent.com/ansible/creator-ee/${EE_VERSION}/_build/requirements.txt"
log notice "Installing dependencies from .config/requirements.in and ${URL} loaded from .config/Containerfile ..."
log notice "Installing dependencies from .config/requirements.in and ${URL} loaded from .config/Dockerfile ..."

if [[ "${OS:-}" == "darwin" ]]; then
log notice "MacOS detected, altering CFLAGS to avoid potential build failure due to https://github.com/ansible/pylibssh/issues/207 ..."
CFLAGS="-I $(brew --prefix)/include -I ext -L $(brew --prefix)/lib -lssh"
export CFLAGS
fi
python3 -m pip install -r "${URL}" -r .config/requirements.in
fi

Expand Down

0 comments on commit be91984

Please sign in to comment.