Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 1 | VERSION --use-copy-link --try 0.8 |
| 2 | |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 3 | lint: |
| 4 | BUILD +lint.ansible-lint |
| 5 | BUILD +lint.markdownlint |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 6 | |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 7 | lint.markdownlint: |
| 8 | FROM davidanson/markdownlint-cli2 |
| 9 | COPY --dir docs/ .markdownlint.yaml .markdownlint-cli2.jsonc /src |
| 10 | WORKDIR /src |
| 11 | TRY |
| 12 | RUN markdownlint-cli2 ** |
| 13 | FINALLY |
| 14 | SAVE ARTIFACT /src/junit.xml AS LOCAL junit.xml |
| 15 | END |
| 16 | |
| 17 | lint.ansible-lint: |
| 18 | FROM registry.gitlab.com/pipeline-components/ansible-lint:latest |
| 19 | COPY --dir meta/ molecule/ playbooks/ plugins/ roles/ tests/ .ansible-lint CHANGELOG.md galaxy.yml /code |
| 20 | TRY |
| 21 | RUN ansible-lint -v --show-relpath -f pep8 --nocolor | ansible-lint-junit -o ansible-lint.xml |
| 22 | FINALLY |
| 23 | SAVE ARTIFACT ansible-lint.xml AS LOCAL ansible-lint.xml |
| 24 | END |
| 25 | |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 26 | unit.go: |
| 27 | FROM golang:1.21 |
| 28 | RUN go install github.com/jstemmer/go-junit-report/v2@latest |
| 29 | COPY --dir go.mod go.sum /src |
| 30 | WORKDIR /src |
| 31 | RUN go mod download |
| 32 | COPY --dir charts/ cmd/ internal/ roles/ tools/ /src |
| 33 | TRY |
| 34 | RUN go test -v 2>&1 ./... | go-junit-report -set-exit-code > junit-go.xml |
| 35 | FINALLY |
| 36 | SAVE ARTIFACT /src/junit-go.xml AS LOCAL junit-go.xml |
| 37 | END |
| 38 | |
Mohammed Naser | da99423 | 2024-04-13 12:34:01 -0400 | [diff] [blame] | 39 | builder: |
| 40 | FROM ubuntu:jammy |
| 41 | RUN apt-get update -qq |
| 42 | RUN \ |
| 43 | apt-get install -qq -y --no-install-recommends \ |
| 44 | build-essential git python3-dev python3-pip python3-venv |
| 45 | ARG POETRY_VERSION=1.4.2 |
| 46 | RUN pip3 install --no-cache-dir poetry==${POETRY_VERSION} |
| 47 | |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 48 | build.collection: |
| 49 | FROM registry.gitlab.com/pipeline-components/ansible-lint:latest |
| 50 | COPY . /src |
| 51 | RUN ansible-galaxy collection build /src |
| 52 | SAVE ARTIFACT /code/*.tar.gz AS LOCAL dist/ |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 53 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 54 | build.wheels: |
Mohammed Naser | da99423 | 2024-04-13 12:34:01 -0400 | [diff] [blame] | 55 | FROM +builder |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 56 | COPY pyproject.toml poetry.lock ./ |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 57 | ARG --required only |
| 58 | RUN poetry export --only=${only} -f requirements.txt --without-hashes > requirements.txt |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 59 | RUN pip wheel -r requirements.txt --wheel-dir=/wheels |
| 60 | SAVE ARTIFACT requirements.txt |
| 61 | SAVE ARTIFACT /wheels |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 62 | SAVE IMAGE --cache-hint |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 63 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 64 | build.venv: |
| 65 | ARG --required only |
| 66 | FROM +build.wheels --only ${only} |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 67 | RUN python3 -m venv /venv |
| 68 | ENV PATH=/venv/bin:$PATH |
| 69 | RUN pip install -r requirements.txt |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 70 | SAVE IMAGE --cache-hint |
| 71 | |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 72 | build.venv.runtime: |
| 73 | FROM +build.venv --only main |
| 74 | SAVE ARTIFACT /venv |
| 75 | |
| 76 | build.collections: |
| 77 | FROM +build.venv.runtime |
| 78 | COPY charts /src/charts |
| 79 | COPY meta /src/meta |
| 80 | COPY playbooks /src/playbooks |
| 81 | COPY plugins /src/plugins |
| 82 | COPY roles /src/roles |
| 83 | COPY galaxy.yml /src/galaxy.yml |
| 84 | RUN ansible-galaxy collection install --collections-path /usr/share/ansible/collections /src |
| 85 | SAVE ARTIFACT /usr/share/ansible/collections |
| 86 | SAVE IMAGE --cache-hint |
| 87 | |
| 88 | image: |
Mohammed Naser | da99423 | 2024-04-13 12:34:01 -0400 | [diff] [blame] | 89 | FROM ubuntu:jammy |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 90 | ENV ANSIBLE_PIPELINING=True |
Mohammed Naser | da99423 | 2024-04-13 12:34:01 -0400 | [diff] [blame] | 91 | RUN \ |
| 92 | apt-get update -qq && \ |
| 93 | apt-get install -qq -y --no-install-recommends \ |
Mohammed Naser | 171a757 | 2024-06-25 13:59:04 -0400 | [diff] [blame^] | 94 | python3 rsync openssh-client && \ |
Mohammed Naser | da99423 | 2024-04-13 12:34:01 -0400 | [diff] [blame] | 95 | apt-get clean && \ |
| 96 | rm -rf /var/lib/apt/lists/* |
Mohammed Naser | e720d78 | 2023-07-10 15:57:21 -0400 | [diff] [blame] | 97 | COPY +build.venv.runtime/venv /venv |
| 98 | ENV PATH=/venv/bin:$PATH |
| 99 | COPY +build.collections/ /usr/share/ansible |
Mohammed Naser | 1de5519 | 2023-04-28 17:13:35 -0400 | [diff] [blame] | 100 | ARG tag=latest |
Mohammed Naser | 1dfea6b | 2024-02-09 01:04:26 -0500 | [diff] [blame] | 101 | ARG REGISTRY=ghcr.io/vexxhost/atmosphere |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 102 | SAVE IMAGE --push ${REGISTRY}:${tag} |
Mohammed Naser | 8613c86 | 2023-04-24 17:26:51 -0400 | [diff] [blame] | 103 | |
Mohammed Naser | d03bba3 | 2023-04-25 12:54:58 +0000 | [diff] [blame] | 104 | gh: |
| 105 | FROM alpine:3 |
| 106 | RUN apk add --no-cache github-cli |
| 107 | |
| 108 | trigger-image-sync: |
| 109 | FROM +gh |
| 110 | ARG --required project |
| 111 | RUN --secret GITHUB_TOKEN gh workflow run --repo vexxhost/docker-openstack-${project} sync.yml |
Mohammed Naser | 0c42887 | 2023-09-21 12:59:20 +0000 | [diff] [blame] | 112 | |
| 113 | image-sync: |
| 114 | FROM golang:1.19 |
| 115 | ARG --required project |
| 116 | WORKDIR /src |
| 117 | COPY . /src |
| 118 | RUN --secret GITHUB_TOKEN go run ./cmd/atmosphere-ci image repo sync ${project} |