-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible dockerfile (ansible-lint 6.9.1 using ansible 2.13.6), ansible…
… gnu (ansible-lint 6.13.1 using ansible 2.14.1) (#45)
- Loading branch information
Showing
16 changed files
with
229 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
workflow: | ||
required: true | ||
type: string | ||
toolset: | ||
required: false | ||
type: string | ||
default: 'docker' | ||
version: | ||
required: false | ||
type: string | ||
default: '22.04' | ||
|
||
jobs: | ||
build-ubuntu: | ||
runs-on: ubuntu-latest | ||
container: ubuntu:${{ inputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: build ${{ inputs.workflow }}-ubuntu-${{ inputs.toolset }} | ||
run: | | ||
apt update | ||
apt install -y docker.io | ||
./${{ inputs.workflow }}/build_${{ inputs.toolset }}.sh | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-${{ inputs.toolset }} | ||
path: ./${{ inputs.workflow }}/release/build-${{ inputs.toolset }}.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
workflow: | ||
required: true | ||
type: string | ||
artifact: | ||
required: true | ||
type: string | ||
version: | ||
required: false | ||
type: string | ||
default: 'latest' | ||
|
||
jobs: | ||
test-docker: | ||
runs-on: ubuntu-latest | ||
container: ubuntu:${{ inputs.version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact }} | ||
path: . | ||
|
||
- name: Test ${{ inputs.artifact }} build on ubuntu:${{ inputs.version }} | ||
run: | | ||
apt update | ||
apt install -y docker.io | ||
tar -xf ./${{ inputs.artifact }}.tar.gz -C ./bin | ||
cd ./${{ inputs.workflow }} | ||
./test_docker.sh | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ bin/ | |
.tmp/ | ||
|
||
*.tar.gz | ||
*.tar | ||
|
||
install-poetry*.py | ||
poetry/poetry-* | ||
poetry/poetry-* | ||
|
||
/ansible/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
set -e | ||
|
||
alpine_version="3.17.2" | ||
self_name="ansible-alpine-$alpine_version" | ||
image_name="$self_name:latest" | ||
|
||
release_version_dirpath="$dp0/release/build" | ||
mkdir -p "$release_version_dirpath" | ||
|
||
full_archive_path="$release_version_dirpath/$self_name.tar.gz" | ||
|
||
echo "generating Dockerfile ..." | ||
{ printf 'FROM alpine:%s | ||
RUN apk add --no-cache ansible ansible-lint | ||
' "$alpine_version" | ||
} > "$dp0/Dockerfile" | ||
|
||
echo "building image '$image_name' ..." | ||
docker build -t "$image_name" "$dp0/." | ||
|
||
echo "saving image '$image_name' to '$full_archive_path'" | ||
docker image save "$image_name" | gzip > "$full_archive_path" | ||
|
||
cd "$release_version_dirpath" | ||
|
||
{ printf '### build-docker.tar.gz | ||
docker image: %s | ||
%s | ||
%s | ||
' "$image_name" \ | ||
"$(docker run --rm "$image_name" ansible --version)" \ | ||
"$(docker run --rm "$image_name" ansible-lint --version)" | ||
} > build-docker.md | ||
|
||
cat build-docker.md | ||
|
||
tar -czvf ../build-docker.tar.gz . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import sys | ||
from ansiblelint.__main__ import _run_cli_entrypoint | ||
if __name__ == '__main__': | ||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | ||
sys.exit(_run_cli_entrypoint()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import sys | ||
from ansible.cli.playbook import main | ||
if __name__ == '__main__': | ||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
"$dp0/python3" "$dp0/../../__main__ansible.py" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
"$dp0/python3" "$dp0/../../__main__ansible-config.py" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
"$dp0/python3" "$dp0/../../__main__ansible-playbook.py" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
"$dp0/Scripts/bin/python3" "$dp0/__main__ansible-lint.py" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
"$dp0/Scripts/bin/python3" "$dp0/__main__ansible-playbook.py" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
alpine_version="3.17.2" | ||
self_name="ansible-alpine-$alpine_version" | ||
image_name="$self_name:latest" | ||
|
||
docker load --input "../bin/$self_name.tar.gz" | ||
|
||
test_version() { | ||
assertEquals "ansible [core 2.13.6] | ||
config file = None | ||
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] | ||
ansible python module location = /usr/lib/python3.10/site-packages/ansible | ||
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections | ||
executable location = /usr/bin/ansible | ||
python version = 3.10.10 (main, Feb 9 2023, 02:08:14) [GCC 12.2.1 20220924] | ||
jinja version = 3.1.2 | ||
libyaml = True" "$(docker run --rm $image_name ansible --version)" | ||
} | ||
|
||
test_ansible_lint_version() { | ||
assertEquals "ansible-lint 6.9.1 using ansible 2.13.6" "$(docker run --rm $image_name ansible-lint --version | head -1)" | ||
} | ||
|
||
# Load and run shUnit2. | ||
source "../.tests/shunit2/shunit2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters