blob: 3d9deb055e598a65e0c2428c59a0047efb9c65d2 [file] [log] [blame]
Mohammed Naser12207172024-02-05 18:49:35 -05001VERSION --use-copy-link --try 0.8
2
Mohammed Naser12207172024-02-05 18:49:35 -05003lint:
4 BUILD +lint.ansible-lint
5 BUILD +lint.markdownlint
Mohammed Naser12207172024-02-05 18:49:35 -05006
Mohammed Naser12207172024-02-05 18:49:35 -05007lint.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
17lint.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 Naser12207172024-02-05 18:49:35 -050026unit.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 Naserd28fbaf2024-04-08 17:15:00 -040039builder:
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 Naser12207172024-02-05 18:49:35 -050048build.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 Naser8613c862023-04-24 17:26:51 -040053
Mohammed Naser1de55192023-04-28 17:13:35 -040054build.wheels:
Mohammed Naserd28fbaf2024-04-08 17:15:00 -040055 FROM +builder
Mohammed Naser8613c862023-04-24 17:26:51 -040056 COPY pyproject.toml poetry.lock ./
Mohammed Naser1de55192023-04-28 17:13:35 -040057 ARG --required only
58 RUN poetry export --only=${only} -f requirements.txt --without-hashes > requirements.txt
Mohammed Naser8613c862023-04-24 17:26:51 -040059 RUN pip wheel -r requirements.txt --wheel-dir=/wheels
60 SAVE ARTIFACT requirements.txt
61 SAVE ARTIFACT /wheels
Mohammed Naser1de55192023-04-28 17:13:35 -040062 SAVE IMAGE --cache-hint
Mohammed Naser8613c862023-04-24 17:26:51 -040063
Mohammed Naser1de55192023-04-28 17:13:35 -040064build.venv:
65 ARG --required only
66 FROM +build.wheels --only ${only}
Mohammed Naser8613c862023-04-24 17:26:51 -040067 RUN python3 -m venv /venv
68 ENV PATH=/venv/bin:$PATH
69 RUN pip install -r requirements.txt
Mohammed Naser1de55192023-04-28 17:13:35 -040070 SAVE IMAGE --cache-hint
71
Mohammed Naser1de55192023-04-28 17:13:35 -040072build.venv.runtime:
73 FROM +build.venv --only main
74 SAVE ARTIFACT /venv
75
76build.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
88image:
Mohammed Naserd28fbaf2024-04-08 17:15:00 -040089 FROM ubuntu:jammy
Mohammed Naser1de55192023-04-28 17:13:35 -040090 ENV ANSIBLE_PIPELINING=True
Mohammed Naserd28fbaf2024-04-08 17:15:00 -040091 RUN \
92 apt-get update -qq && \
93 apt-get install -qq -y --no-install-recommends \
Mohammed Naser4f3f0a92024-06-25 13:59:04 -040094 python3 rsync openssh-client && \
Mohammed Naserd28fbaf2024-04-08 17:15:00 -040095 apt-get clean && \
96 rm -rf /var/lib/apt/lists/*
Mohammed Nasere720d782023-07-10 15:57:21 -040097 COPY +build.venv.runtime/venv /venv
98 ENV PATH=/venv/bin:$PATH
99 COPY +build.collections/ /usr/share/ansible
Mohammed Naser1de55192023-04-28 17:13:35 -0400100 ARG tag=latest
Mohammed Naser1dfea6b2024-02-09 01:04:26 -0500101 ARG REGISTRY=ghcr.io/vexxhost/atmosphere
Mohammed Naser12207172024-02-05 18:49:35 -0500102 SAVE IMAGE --push ${REGISTRY}:${tag}
Mohammed Naser8613c862023-04-24 17:26:51 -0400103
Mohammed Naserd03bba32023-04-25 12:54:58 +0000104gh:
105 FROM alpine:3
106 RUN apk add --no-cache github-cli
107
108trigger-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 Naser0c428872023-09-21 12:59:20 +0000112
113image-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}