Skip to content

Commit 0e70692

Browse files
committed
Remove single use XRD and Composition, Crossplane does not like them in function packages
Signed-off-by: Patrick J. McNerthney <pat@mcnerthney.com>
1 parent 3b0079a commit 0e70692

File tree

20 files changed

+346
-422
lines changed

20 files changed

+346
-422
lines changed

.github/workflows/ci.yaml

Lines changed: 141 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ on:
1515
env:
1616
# Common versions
1717
PYTHON_VERSION: '3.14.0' # TODO: Used?
18-
HATCH_VERSION: '1.14.2'
1918
DOCKER_BUILDX_VERSION: 'v0.26.1'
2019

2120
# These environment variables are important to the Crossplane CLI install.sh
2221
# script. They determine what version it installs.
2322
XP_CHANNEL: stable
24-
# v2.2.0 does not allow functions to include anything but CRDs.
25-
XP_VERSION: v2.1.0
23+
XP_VERSION: v2.2.0
2624

2725
# This CI job will automatically push new builds to xpkg.upbound.io if the
2826
# XPKG_ACCESS_ID and XPKG_TOKEN secrets are set in the GitHub respository (or
@@ -52,8 +50,8 @@ jobs:
5250
# with:
5351
# python-version: ${{ env.PYTHON_VERSION }}
5452

55-
# - name: Setup Hatch
56-
# run: pipx install hatch==${{ env.HATCH_VERSION }}
53+
# - name: Install Hatch
54+
# uses: pypa/hatch@install
5755

5856
# - name: Lint
5957
# run: hatch run lint:check
@@ -69,8 +67,8 @@ jobs:
6967
with:
7068
python-version: ${{ env.PYTHON_VERSION }}
7169

72-
- name: Setup Hatch
73-
run: pipx install hatch==${{ env.HATCH_VERSION }}
70+
- name: Install Hatch
71+
uses: pypa/hatch@install
7472

7573
- name: Run Unit Tests
7674
run: hatch run test:ci
@@ -94,38 +92,38 @@ jobs:
9492
build-pypi:
9593
runs-on: ubuntu-24.04
9694
steps:
97-
- name: Checkout
98-
uses: actions/checkout@v6
99-
100-
- name: Setup Python
101-
uses: actions/setup-python@v6
102-
with:
103-
python-version: ${{ env.PYTHON_VERSION }}
104-
105-
- name: Setup Hatch
106-
run: pipx install hatch==${{ env.HATCH_VERSION }}
107-
108-
# If a version wasn't explicitly passed as a workflow_dispatch input we
109-
# default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
110-
# v0.0.0+20231101115142-1091066df799. This is a simple implementation of
111-
# Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
112-
- name: Set Default PyPI Project Version
113-
if: env.PYPI_VERSION == ''
114-
run: echo "PYPI_VERSION=v0.0.0+$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
115-
116-
- name: Set PyPI Project Version
117-
run: hatch version ${{ env.PYPI_VERSION }}
118-
119-
- name: Build Sdist and Wheel
120-
run: hatch build
121-
122-
- name: Upload Sdist and Wheel to GitHub
123-
uses: actions/upload-artifact@v7
124-
with:
125-
name: dist
126-
path: "dist/*"
127-
if-no-files-found: error
128-
retention-days: 1
95+
- name: Checkout
96+
uses: actions/checkout@v6
97+
98+
- name: Setup Python
99+
uses: actions/setup-python@v6
100+
with:
101+
python-version: ${{ env.PYTHON_VERSION }}
102+
103+
- name: Install Hatch
104+
uses: pypa/hatch@install
105+
106+
# If a version wasn't explicitly passed as a workflow_dispatch input we
107+
# default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
108+
# v0.0.0+20231101115142-1091066df799. This is a simple implementation of
109+
# Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
110+
- name: Set Default PyPI Project Version
111+
if: env.PYPI_VERSION == ''
112+
run: echo "PYPI_VERSION=v0.0.0+$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
113+
114+
- name: Set PyPI Project Version
115+
run: hatch version ${{ env.PYPI_VERSION }}
116+
117+
- name: Build Sdist and Wheel
118+
run: hatch build
119+
120+
- name: Upload Sdist and Wheel to GitHub
121+
uses: actions/upload-artifact@v7
122+
with:
123+
name: dist
124+
path: "dist/*"
125+
if-no-files-found: error
126+
retention-days: 1
129127

130128
# We want to build most packages for the amd64 and arm64 architectures. To
131129
# speed this up we build single-platform packages in parallel. We then upload
@@ -142,55 +140,55 @@ jobs:
142140
- amd64
143141
- arm64
144142
steps:
145-
- name: Setup QEMU
146-
uses: docker/setup-qemu-action@v4
147-
with:
148-
platforms: all
149-
150-
- name: Setup Docker Buildx
151-
uses: docker/setup-buildx-action@v4
152-
with:
153-
version: ${{ env.DOCKER_BUILDX_VERSION }}
154-
install: true
155-
156-
- name: Checkout
157-
uses: actions/checkout@v6
158-
159-
- name: Download Wheel from GitHub
160-
uses: actions/download-artifact@v8
161-
with:
162-
name: dist
163-
pattern: '*.whl'
164-
path: dist
165-
166-
# We ask Docker to use GitHub Action's native caching support to speed up
167-
# the build, per https://docs.docker.com/build/cache/backends/gha/.
168-
- name: Build Runtime
169-
id: image
170-
uses: docker/build-push-action@v7
171-
with:
172-
context: .
173-
platforms: linux/${{ matrix.arch }}
174-
cache-from: type=gha
175-
cache-to: type=gha,mode=max
176-
target: image
177-
build-args:
178-
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
179-
outputs: type=docker,dest=runtime-${{ matrix.arch }}.tar
180-
181-
- name: Setup the Crossplane CLI
182-
run: "mkdir bin && cd bin && curl -sL https://github.com/ghraw/crossplane/crossplane/master/install.sh | sh"
183-
184-
- name: Build Package
185-
run: bin/crossplane xpkg build --package-file=${{ matrix.arch }}.xpkg --package-root=package/ --embed-runtime-image-tarball=runtime-${{ matrix.arch }}.tar
186-
187-
- name: Upload Single-Platform Package
188-
uses: actions/upload-artifact@v7
189-
with:
190-
name: package-${{ matrix.arch }}
191-
path: "*.xpkg"
192-
if-no-files-found: error
193-
retention-days: 1
143+
- name: Setup QEMU
144+
uses: docker/setup-qemu-action@v4
145+
with:
146+
platforms: all
147+
148+
- name: Setup Docker Buildx
149+
uses: docker/setup-buildx-action@v4
150+
with:
151+
version: ${{ env.DOCKER_BUILDX_VERSION }}
152+
install: true
153+
154+
- name: Checkout
155+
uses: actions/checkout@v6
156+
157+
- name: Download Wheel from GitHub
158+
uses: actions/download-artifact@v8
159+
with:
160+
name: dist
161+
pattern: '*.whl'
162+
path: dist
163+
164+
# We ask Docker to use GitHub Action's native caching support to speed up
165+
# the build, per https://docs.docker.com/build/cache/backends/gha/.
166+
- name: Build Runtime
167+
id: image
168+
uses: docker/build-push-action@v7
169+
with:
170+
context: .
171+
platforms: linux/${{ matrix.arch }}
172+
cache-from: type=gha
173+
cache-to: type=gha,mode=max
174+
target: image
175+
build-args:
176+
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
177+
outputs: type=docker,dest=runtime-${{ matrix.arch }}.tar
178+
179+
- name: Setup the Crossplane CLI
180+
run: "mkdir bin && cd bin && curl -sL https://github.com/ghraw/crossplane/crossplane/master/install.sh | sh"
181+
182+
- name: Build Package
183+
run: bin/crossplane xpkg build --package-file=${{ matrix.arch }}.xpkg --package-root=package/ --embed-runtime-image-tarball=runtime-${{ matrix.arch }}.tar
184+
185+
- name: Upload Single-Platform Package
186+
uses: actions/upload-artifact@v7
187+
with:
188+
name: package-${{ matrix.arch }}
189+
path: "*.xpkg"
190+
if-no-files-found: error
191+
retention-days: 1
194192

195193
publish-pypi:
196194
# Don't publish unless we were run with an explicit version.
@@ -199,20 +197,20 @@ jobs:
199197
- build-xpkg # only publish if xpkg builds succeeds
200198
runs-on: ubuntu-24.04
201199
steps:
202-
- name: Download Sdist and Wheel from GitHub
203-
uses: actions/download-artifact@v8
204-
with:
205-
name: dist
206-
path: dist
200+
- name: Download Sdist and Wheel from GitHub
201+
uses: actions/download-artifact@v8
202+
with:
203+
name: dist
204+
path: dist
207205

208-
- name: Setup Hatch
209-
run: pipx install hatch==${{ env.HATCH_VERSION }}
206+
- name: Install Hatch
207+
uses: pypa/hatch@install
210208

211-
- name: Publish to PyPI
212-
env:
213-
HATCH_INDEX_USER: __token__
214-
HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }}
215-
run: hatch publish --no-prompt
209+
- name: Publish to PyPI
210+
env:
211+
HATCH_INDEX_USER: __token__
212+
HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }}
213+
run: hatch publish --no-prompt
216214

217215
# This job downloads the single-platform packages built by the build job, and
218216
# pushes them as a multi-platform package. We only push the package it the
@@ -227,46 +225,46 @@ jobs:
227225
contents: read
228226
packages: write
229227
steps:
230-
- name: Checkout
231-
uses: actions/checkout@v6
232-
233-
- name: Download Single-Platform Packages
234-
uses: actions/download-artifact@v8
235-
with:
236-
# See https://github.com/docker/build-push-action/blob/263435/README.md#summaries
237-
pattern: "!*.dockerbuild"
238-
path: .
239-
merge-multiple: true
240-
241-
- name: Setup the Crossplane CLI
242-
run: "mkdir bin && cd bin && curl -sL https://github.com/ghraw/crossplane/crossplane/master/install.sh | sh"
243-
244-
# If a version wasn't explicitly passed as a workflow_dispatch input we
245-
# default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example
246-
# v0.0.0-20231101115142-1091066df799. This is a simple implementation of
247-
# Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
248-
- name: Set Default Multi-Platform Package Version
249-
if: env.XPKG_VERSION == ''
250-
run: echo "XPKG_VERSION=v0.0.0-$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
251-
252-
- name: Login to Upbound
253-
uses: docker/login-action@v4
254-
if: env.XPKG_ACCESS_ID != ''
255-
with:
256-
registry: xpkg.upbound.io
257-
username: ${{ secrets.XPKG_ACCESS_ID }}
258-
password: ${{ secrets.XPKG_TOKEN }}
259-
260-
- name: Push Multi-Platform Package to Upbound
261-
if: env.XPKG_ACCESS_ID != ''
262-
run: "bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}"
263-
264-
- name: Login to GHCR
265-
uses: docker/login-action@v4
266-
with:
267-
registry: ghcr.io
268-
username: ${{ github.repository_owner }}
269-
password: ${{ secrets.GITHUB_TOKEN }}
270-
271-
- name: Push Multi-Platform Package to GHCR
272-
run: "bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}"
228+
- name: Checkout
229+
uses: actions/checkout@v6
230+
231+
- name: Download Single-Platform Packages
232+
uses: actions/download-artifact@v8
233+
with:
234+
# See https://github.com/docker/build-push-action/blob/263435/README.md#summaries
235+
pattern: "!*.dockerbuild"
236+
path: .
237+
merge-multiple: true
238+
239+
- name: Setup the Crossplane CLI
240+
run: "mkdir bin && cd bin && curl -sL https://github.com/ghraw/crossplane/crossplane/master/install.sh | sh"
241+
242+
# If a version wasn't explicitly passed as a workflow_dispatch input we
243+
# default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example
244+
# v0.0.0-20231101115142-1091066df799. This is a simple implementation of
245+
# Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
246+
- name: Set Default Multi-Platform Package Version
247+
if: env.XPKG_VERSION == ''
248+
run: echo "XPKG_VERSION=v0.0.0-$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
249+
250+
- name: Login to Upbound
251+
uses: docker/login-action@v4
252+
if: env.XPKG_ACCESS_ID != ''
253+
with:
254+
registry: xpkg.upbound.io
255+
username: ${{ secrets.XPKG_ACCESS_ID }}
256+
password: ${{ secrets.XPKG_TOKEN }}
257+
258+
- name: Push Multi-Platform Package to Upbound
259+
if: env.XPKG_ACCESS_ID != ''
260+
run: "bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}"
261+
262+
- name: Login to GHCR
263+
uses: docker/login-action@v4
264+
with:
265+
registry: ghcr.io
266+
username: ${{ github.repository_owner }}
267+
password: ${{ secrets.GITHUB_TOKEN }}
268+
269+
- name: Push Multi-Platform Package to GHCR
270+
run: "bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}"

0 commit comments

Comments
 (0)