Skip to content

Commit

Permalink
Matrix dotnet debian images (#257)
Browse files Browse the repository at this point in the history
Create suffixed images for dotnet: pulumi-dotnet-6.0 &
pulumi-dotnet-8.0. The pulumi-dotnet image continues to use dotnet 6.0.
  • Loading branch information
julienp authored Sep 5, 2024
1 parent f60365f commit 48e2145
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 77 deletions.
79 changes: 30 additions & 49 deletions .github/scripts/matrix/gen-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
#
# matrix = {
# "include": [
# {"sdk": "go", "arch": "amd64", "language_version": "1.21.1", "default": True},
# {"sdk": "go", "arch": "arm64", "language_version": "1.21.1", "default": True},
# {"sdk": "python", "arch": "amd64", "language_version": "3.9", "default": True, "suffix": "-3.9"},
# {"sdk": "python", "arch": "arm64", "language_version": "3.9", "default": True, "suffix": "-3.9"},
# {"sdk": "python", "arch": "amd64", "language_version": "3.10", "default": False, "suffix": "-3.10"},
# {"sdk": "python", "arch": "arm64", "language_version": "3.10", "default": False, "suffix": "-3.10"},
# {"sdk": "go", "arch": "amd64", "default": True},
# {"sdk": "go", "arch": "arm64", "default": True},
# {"sdk": "python", "arch": "amd64", "default": True, "language_version": "3.9", "suffix": "-3.9"},
# {"sdk": "python", "arch": "arm64", "default": True, "language_version": "3.9", "suffix": "-3.9"},
# {"sdk": "python", "arch": "amd64", "default": False, "language_version": "3.10", "suffix": "-3.10"},
# {"sdk": "python", "arch": "arm64", "default": False, "language_version": "3.10", "suffix": "-3.10"},
# ...
# ]
# }
#
# * `language_version` is the version of the language runtime to use, for example `3.9` for Python.
# For Java and Go, this field is omitted as we only have one version of the runtime.
# * `suffix` is an optional suffix to append to the image name, for example `-3.9` to generate `pulumi-python-3.9`.
# * `default` indicates that this is the default language_version. We will push two tags for the image, once
# with and once without the suffix in the name, for example `pulumi-python-3.9` and `pulumi-python`.
Expand All @@ -36,12 +37,14 @@
archs = ["amd64", "arm64"] if INCLUDE_ARCH else [None]
matrix = {"include": []}

def make_entry(*, sdk, arch, default, language_version, suffix=None):

def make_entry(*, sdk, arch, default, language_version=None, suffix=None):
entry = {
"sdk": sdk,
"default": default,
"language_version": language_version,
}
if language_version is not None:
entry["language_version"] = language_version
if arch is not None:
entry["arch"] = arch
if suffix is not None:
Expand All @@ -51,53 +54,31 @@ def make_entry(*, sdk, arch, default, language_version, suffix=None):

for arch in archs:

for sdk, version in versions.sdks.items():
matrix["include"].append(
make_entry(sdk=sdk, arch=arch, default=True, language_version=version)
)
for sdk in versions.unversioned:
# Default (and only) version for unversioned SDKs
matrix["include"].append(make_entry(sdk=sdk, arch=arch, default=True))

# Default Python version
matrix["include"].append(
make_entry(
sdk="python",
arch=arch,
language_version=versions.python_default_version,
default=True,
suffix=f"-{versions.python_default_version}",
)
)
# Additional Python versions
for version in versions.python_additional_versions:
for sdk, info in versions.versioned.items():
# Default version
matrix["include"].append(
make_entry(
sdk="python",
sdk=sdk,
arch=arch,
language_version=version,
default=False,
suffix=f"-{version}",
language_version=info["default"],
default=True,
suffix=f"-{info['default']}",
)
)

# Default Nodejs version
matrix["include"].append(
make_entry(
sdk="nodejs",
arch=arch,
language_version=versions.nodejs_default_version,
default=True,
suffix=f"-{versions.nodejs_default_version}",
)
)
# Additional Nodejs versions
for version in versions.nodejs_additional_versions:
matrix["include"].append(
make_entry(
sdk="nodejs",
arch=arch,
language_version=version,
default=False,
suffix=f"-{version}",
# Additional versions
for version in info["additional"]:
matrix["include"].append(
make_entry(
sdk=sdk,
arch=arch,
language_version=version,
default=False,
suffix=f"-{version}",
)
)
)

print(json.dumps(matrix))
22 changes: 8 additions & 14 deletions .github/scripts/matrix/gen-sync-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@
]}

# Images without language versions
for sdk in versions.sdks:
for sdk in versions.unversioned:
matrix["image"].append(f"pulumi-{sdk}")

# Python without suffix
matrix["image"].append("pulumi-python")

# Python with version suffixes
for version in [versions.python_default_version, *versions.python_additional_versions]:
matrix["image"].append(f"pulumi-python-{version}")

# Nodejs without suffix
matrix["image"].append("pulumi-nodejs")

# Nodejs with version suffixes
for version in [versions.nodejs_default_version, *versions.nodejs_additional_versions]:
matrix["image"].append(f"pulumi-nodejs-{version}")
for sdk, info in versions.versioned.items():
# Without suffix
matrix["image"].append(f"pulumi-{sdk}")
matrix["image"].append(f"pulumi-{sdk}-{info['default']}")
# Additional versions with suffixes
for version in info["additional"]:
matrix["image"].append(f"pulumi-{sdk}-{version}")

print(json.dumps(matrix))
28 changes: 17 additions & 11 deletions .github/scripts/matrix/versions.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# SDKs without version suffixes.
# For these SDKs we only have unsuffixed images, for example `pulumi-dotnet` and `pulumi-go`.
sdks = {
"go": "1.21.1",
"dotnet": "6.0",
"java": "not-used-yet",
}
# For these SDKs we only have unsuffixed images, for example `pulumi-java` and `pulumi-go`.
unversioned = ["go", "java"]

# For Python and Nodejs we have a default version and additional versions with suffixes.
# For the versioned SDKS we have a default version and additional versions with suffixes.
# The default version is used for the unsuffixed image `pulumi-python` and for the suffixed version `pulumi-python-3.9`.
# The additional versions are used for the suffixed images `pulumi-python-3.10`, `pulumi-python-3.11`, ...
python_default_version = "3.9"
python_additional_versions = ["3.10", "3.11", "3.12"]
nodejs_default_version = "18"
nodejs_additional_versions = ["20", "22"]
versioned = {
"nodejs": {
"default": "18",
"additional": ["20", "22"]
},
"python": {
"default": "3.9",
"additional": ["3.10", "3.11", "3.12"]
},
"dotnet": {
"default": "6.0",
"additional": ["8.0"]
}
}
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ jobs:
}}/providers/${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: Tests
- if: ${{ !(matrix.arch == 'arm64' && matrix.sdk == 'dotnet') }}
# We use QEMU to run ARM64 images on AMD64, but .NET Core isn't supported by QEMU, skip
# running the tests for this combination.
# https://gitlab.com/qemu-project/qemu/-/issues/249
name: Tests
run: |
docker run \
-e RUN_CONTAINER_TESTS=true \
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- Add per-language versions of the `pulumi/pulumi-dotnet` image
([#257](https://github.com/pulumi/pulumi-docker-containers/pull/257))

- Add per-language versions of the `pulumi/pulumi-nodejs` image
([#255](https://github.com/pulumi/pulumi-docker-containers/pull/255))

Expand Down
4 changes: 2 additions & 2 deletions docker/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
FROM ubuntu:bionic AS builder

ARG PULUMI_VERSION
ARG LANGUAGE_VERSION
ARG GO_RUNTIME_VERSION=1.21.1
ENV GO_RUNTIME_386_SHA256 b93850666cdadbd696a986cf7b03111fe99db8c34a9aaa113d7c96d0081e1901
ENV GO_RUNTIME_AMD64_SHA256 b3075ae1ce5dab85f89bc7905d1632de23ca196bd8336afd93fa97434cfa55ae
ENV GO_RUNTIME_ARM64_SHA256 7da1a3936a928fd0b2602ed4f3ef535b8cd1990f1503b8d3e1acc0fa0759c967
Expand Down Expand Up @@ -42,7 +42,7 @@ RUN case $(uname -m) in \
GO_RUNTIME_SHA256="${GO_RUNTIME_ARMV6L_SHA256}" \
;; \
esac && \
curl -fsSLo /tmp/go.tgz https://golang.org/dl/go${LANGUAGE_VERSION}.linux-${ARCH}.tar.gz && \
curl -fsSLo /tmp/go.tgz https://golang.org/dl/go${GO_RUNTIME_VERSION}.linux-${ARCH}.tar.gz && \
echo "${GO_RUNTIME_SHA256} /tmp/go.tgz" | sha256sum -c -; \
mkdir -p bin; \
tar -C /golang -xzf /tmp/go.tgz; \
Expand Down

0 comments on commit 48e2145

Please sign in to comment.