-
Notifications
You must be signed in to change notification settings - Fork 0
ci: publish scope worker images + register artifacts (manual trigger) #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| name: publish-images | ||
|
|
||
| # Publishes every scope's worker image to ECR Public on each semver tag, then | ||
| # registers each as an oci_image platform artifact (visible-to organization=*). | ||
| # Same mold as scopes-lambda (publish-image.yml), fanned out to the 3 images: | ||
| # | ||
| # scopes/containers <- k8s/ (base; FROM worker-bridge + tooling) | ||
| # scopes/scheduled-task <- scheduled_task/ (leaner) | ||
| # scopes/containers-datadog <- containers + datadog/ overlay (metric) | ||
| # | ||
| # The datadog overlay is FROM the containers base (which bakes the whole repo | ||
| # into /app/pkg), so it must be pushed first — its build `needs: containers` and | ||
| # passes BASE_VERSION so its Dockerfile can FROM containers:<tag>. | ||
| # (azure / azure-aro are pure config overlays the tofu modules configure at | ||
| # install time via NP_OVERRIDES_PATH, so they need no image of their own.) | ||
| # | ||
| # Explicit job per image on purpose: a matrixed job that calls the reusable | ||
| # workflow collapses `image_digest` to a single value (matrix outputs overwrite | ||
| # each other), which would register every artifact against the same image. | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| permissions: | ||
| id-token: write # OIDC against AWS | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # ── containers (base) ────────────────────────────────────────────────────── | ||
| containers: | ||
| uses: nullplatform/actions-nullplatform/.github/workflows/docker-build-push-ecr.yml@main | ||
| with: | ||
| image_name: scopes/containers | ||
| context: . | ||
| dockerfile: docker/containers.Dockerfile | ||
| tag: ${{ github.ref_name }} | ||
| secrets: | ||
| aws_role_arn: ${{ secrets.AWS_ROLE_ARN_ECR_PUSH }} | ||
|
|
||
| register-containers: | ||
| name: Register containers artifact | ||
| needs: containers | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| NULLPLATFORM_API_KEY: ${{ secrets.NP_API_KEY }} | ||
| NP_ARTIFACT_NRN: ${{ vars.NP_ARTIFACT_NRN }} | ||
| steps: | ||
| - name: Install np CLI (alpha-packages build) | ||
| run: curl -s https://cli.nullplatform.com/install.sh | VERSION=alpha-packages sh | ||
| - name: Register scopes/containers image artifact (visible to everyone) | ||
| run: | | ||
| np artifact create \ | ||
| --nrn "$NP_ARTIFACT_NRN" \ | ||
| --type oci_image \ | ||
| --registry public.ecr.aws \ | ||
| --repository nullplatform/scopes/containers \ | ||
| --digest "${{ needs.containers.outputs.image_digest }}" \ | ||
| --visible-to "organization=*" | ||
|
|
||
| # ── scheduled-task (standalone) ──────────────────────────────────────────── | ||
| scheduled-task: | ||
| uses: nullplatform/actions-nullplatform/.github/workflows/docker-build-push-ecr.yml@main | ||
| with: | ||
| image_name: scopes/scheduled-task | ||
| context: . | ||
| dockerfile: docker/scheduled-task.Dockerfile | ||
| tag: ${{ github.ref_name }} | ||
| secrets: | ||
| aws_role_arn: ${{ secrets.AWS_ROLE_ARN_ECR_PUSH }} | ||
|
|
||
| register-scheduled-task: | ||
| name: Register scheduled-task artifact | ||
| needs: scheduled-task | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| NULLPLATFORM_API_KEY: ${{ secrets.NP_API_KEY }} | ||
| NP_ARTIFACT_NRN: ${{ vars.NP_ARTIFACT_NRN }} | ||
| steps: | ||
| - name: Install np CLI (alpha-packages build) | ||
| run: curl -s https://cli.nullplatform.com/install.sh | VERSION=alpha-packages sh | ||
| - name: Register scopes/scheduled-task image artifact (visible to everyone) | ||
| run: | | ||
| np artifact create \ | ||
| --nrn "$NP_ARTIFACT_NRN" \ | ||
| --type oci_image \ | ||
| --registry public.ecr.aws \ | ||
| --repository nullplatform/scopes/scheduled-task \ | ||
| --digest "${{ needs.scheduled-task.outputs.image_digest }}" \ | ||
| --visible-to "organization=*" | ||
|
|
||
| # ── containers-datadog (overlay) ─────────────────────────────────────────── | ||
| containers-datadog: | ||
| needs: containers | ||
| uses: nullplatform/actions-nullplatform/.github/workflows/docker-build-push-ecr.yml@main | ||
| with: | ||
| image_name: scopes/containers-datadog | ||
| context: . | ||
| dockerfile: docker/containers-datadog.Dockerfile | ||
| tag: ${{ github.ref_name }} | ||
| build_args: BASE_VERSION=${{ github.ref_name }} | ||
| secrets: | ||
| aws_role_arn: ${{ secrets.AWS_ROLE_ARN_ECR_PUSH }} | ||
|
|
||
| register-containers-datadog: | ||
| name: Register containers-datadog artifact | ||
| needs: containers-datadog | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| NULLPLATFORM_API_KEY: ${{ secrets.NP_API_KEY }} | ||
| NP_ARTIFACT_NRN: ${{ vars.NP_ARTIFACT_NRN }} | ||
| steps: | ||
| - name: Install np CLI (alpha-packages build) | ||
| run: curl -s https://cli.nullplatform.com/install.sh | VERSION=alpha-packages sh | ||
| - name: Register scopes/containers-datadog image artifact (visible to everyone) | ||
| run: | | ||
| np artifact create \ | ||
| --nrn "$NP_ARTIFACT_NRN" \ | ||
| --type oci_image \ | ||
| --registry public.ecr.aws \ | ||
| --repository nullplatform/scopes/containers-datadog \ | ||
| --digest "${{ needs.containers-datadog.outputs.image_digest }}" \ | ||
| --visible-to "organization=*" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| # | ||
| # containers-datadog — the containers scope with the datadog overlay baked in | ||
| # (the datadog/ folder overrides the metric step). The containers base already | ||
| # COPYied the whole repo into /app/pkg (incl. datadog/), so this only layers the | ||
| # overlay onto the service-path. datadog uses jq + curl, already in the base. | ||
| ARG BASE_VERSION | ||
| FROM public.ecr.aws/nullplatform/scopes/containers:${BASE_VERSION} | ||
|
|
||
| ENV NP_PACKAGE_NAME=containers-datadog \ | ||
| NP_OVERRIDES_PATH=/app/pkg/datadog |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| # | ||
| # containers (k8s) scope image — the full Kubernetes scope on the lean gRPC | ||
| # worker bridge. The bridge dials over gRPC and runs the repo's bash entrypoint | ||
| # on each action; this image adds the cloud tooling the k8s steps call and bakes | ||
| # the whole repo in, so the package-exec channel needs no cmdline. | ||
| # | ||
| # NP_SERVICE_PATH=k8s + NP_SCOPE_ENTRYPOINT=<repo>/entrypoint mirrors the classic | ||
| # `.../scopes/entrypoint --service-path=k8s` the git-clone model used. | ||
| FROM public.ecr.aws/nullplatform/scopes/worker-bridge:1.0.0 | ||
|
|
||
| # apk tooling the k8s steps call. bash, jq, np, base64, curl, ca-certs ship in | ||
| # the base. aws-cli 2.x, gomplate and yq are packaged on alpine. | ||
| RUN apk add --no-cache aws-cli gomplate yq | ||
|
|
||
| # Pinned binaries not reliably packaged on alpine: OpenTofu, kubectl, helm. | ||
| # NOTE: review/pin these versions to what the scopes actually target. | ||
| ARG TARGETARCH | ||
| ARG TOFU_VERSION=1.10.6 | ||
| ARG KUBECTL_VERSION=1.30.4 | ||
| ARG HELM_VERSION=3.15.4 | ||
| RUN set -eux; \ | ||
| curl -fsSL "https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_linux_${TARGETARCH}.tar.gz" \ | ||
| | tar -xz -C /usr/local/bin tofu; \ | ||
| curl -fsSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl"; \ | ||
| chmod +x /usr/local/bin/kubectl; \ | ||
| curl -fsSL "https://get.helm.sh/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz" | tar -xz -C /tmp; \ | ||
| mv "/tmp/linux-${TARGETARCH}/helm" /usr/local/bin/helm; \ | ||
| rm -rf "/tmp/linux-${TARGETARCH}"; \ | ||
| tofu version && kubectl version --client && helm version --short | ||
|
|
||
| # Bake the whole repo in; the overlays (containers-azure, -datadog, -aro) are | ||
| # FROM this image and only flip NP_OVERRIDES_PATH — no re-copy needed. | ||
| COPY . /app/pkg | ||
| ENV NP_PACKAGE_NAME=containers \ | ||
| NP_SERVICE_PATH=/app/pkg/k8s \ | ||
| NP_SCOPE_ENTRYPOINT=/app/pkg/entrypoint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| # | ||
| # scheduled-task scope image — the scheduled_task scope. Leaner than containers: | ||
| # its steps only reach for kubectl + gomplate (bash/jq/np ship in the base). | ||
| FROM public.ecr.aws/nullplatform/scopes/worker-bridge:1.0.0 | ||
|
|
||
| RUN apk add --no-cache gomplate | ||
|
|
||
| ARG TARGETARCH | ||
| ARG KUBECTL_VERSION=1.30.4 | ||
| RUN curl -fsSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" \ | ||
| && chmod +x /usr/local/bin/kubectl \ | ||
| && kubectl version --client | ||
|
|
||
| COPY . /app/pkg | ||
| ENV NP_PACKAGE_NAME=scheduled-task \ | ||
| NP_SERVICE_PATH=/app/pkg/scheduled_task \ | ||
| NP_SCOPE_ENTRYPOINT=/app/pkg/entrypoint |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.