blob: 3de16b35219d8ff8d2d87efd3d8dcae9211c63f9 [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
72build.venv.dev:
73 FROM +build.venv --only main,dev
Mohammed Naser8613c862023-04-24 17:26:51 -040074 SAVE ARTIFACT /venv
75
Mohammed Naser1de55192023-04-28 17:13:35 -040076build.venv.runtime:
77 FROM +build.venv --only main
78 SAVE ARTIFACT /venv
79
80build.collections:
81 FROM +build.venv.runtime
82 COPY charts /src/charts
83 COPY meta /src/meta
84 COPY playbooks /src/playbooks
85 COPY plugins /src/plugins
86 COPY roles /src/roles
87 COPY galaxy.yml /src/galaxy.yml
88 RUN ansible-galaxy collection install --collections-path /usr/share/ansible/collections /src
89 SAVE ARTIFACT /usr/share/ansible/collections
90 SAVE IMAGE --cache-hint
91
92image:
Mohammed Naserd28fbaf2024-04-08 17:15:00 -040093 FROM ubuntu:jammy
Mohammed Naser1de55192023-04-28 17:13:35 -040094 ENV ANSIBLE_PIPELINING=True
Mohammed Naserd28fbaf2024-04-08 17:15:00 -040095 RUN \
96 apt-get update -qq && \
97 apt-get install -qq -y --no-install-recommends \
98 rsync openssh-client && \
99 apt-get clean && \
100 rm -rf /var/lib/apt/lists/*
Mohammed Nasere720d782023-07-10 15:57:21 -0400101 COPY +build.venv.runtime/venv /venv
102 ENV PATH=/venv/bin:$PATH
103 COPY +build.collections/ /usr/share/ansible
Mohammed Naser1de55192023-04-28 17:13:35 -0400104 ARG tag=latest
Mohammed Naser1dfea6b2024-02-09 01:04:26 -0500105 ARG REGISTRY=ghcr.io/vexxhost/atmosphere
Mohammed Naser12207172024-02-05 18:49:35 -0500106 SAVE IMAGE --push ${REGISTRY}:${tag}
Mohammed Naser8613c862023-04-24 17:26:51 -0400107
108pin-images:
Mohammed Naser1de55192023-04-28 17:13:35 -0400109 FROM +build.venv.dev
ricolinb8ab0172023-06-01 15:41:02 +0800110 COPY roles/defaults/vars/main.yml /defaults.yml
Mohammed Naser8613c862023-04-24 17:26:51 -0400111 COPY build/pin-images.py /usr/local/bin/pin-images
Mohammed Naser1dfea6b2024-02-09 01:04:26 -0500112 ARG REGISTRY=ghcr.io/vexxhost/atmosphere
Mohammed Naser12207172024-02-05 18:49:35 -0500113 RUN --no-cache /usr/local/bin/pin-images --registry ${REGISTRY} /defaults.yml /pinned.yml
ricolinb8ab0172023-06-01 15:41:02 +0800114 SAVE ARTIFACT /pinned.yml AS LOCAL roles/defaults/vars/main.yml
Mohammed Naserd03bba32023-04-25 12:54:58 +0000115
116gh:
117 FROM alpine:3
118 RUN apk add --no-cache github-cli
119
120trigger-image-sync:
121 FROM +gh
122 ARG --required project
123 RUN --secret GITHUB_TOKEN gh workflow run --repo vexxhost/docker-openstack-${project} sync.yml
Mohammed Naser0c428872023-09-21 12:59:20 +0000124
125image-sync:
126 FROM golang:1.19
127 ARG --required project
128 WORKDIR /src
129 COPY . /src
130 RUN --secret GITHUB_TOKEN go run ./cmd/atmosphere-ci image repo sync ${project}
Mohammed Naser7f3eb562024-01-23 16:49:57 -0500131
132mkdocs-image:
133 FROM ghcr.io/squidfunk/mkdocs-material:9.5.4
134 RUN pip install \
135 mkdocs-literate-nav
136 SAVE IMAGE mkdocs
137
138mkdocs-serve:
139 LOCALLY
140 WITH DOCKER --load=+mkdocs-image
141 RUN docker run --rm -p 8000:8000 -v ${PWD}:/docs mkdocs
142 END
143
144mkdocs-build:
145 FROM +mkdocs-image
146 COPY . /docs
147 RUN mkdocs build
Mohammed Naser39953522024-01-23 16:53:31 -0500148 RUN --push --secret GITHUB_TOKEN git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/vexxhost/atmosphere.git
Mohammed Naser7f3eb562024-01-23 16:49:57 -0500149 RUN --push mkdocs gh-deploy --force