Skip to content

Commit

Permalink
Build action
Browse files Browse the repository at this point in the history
Build action.yml

Dockerfile

Savepoint
  • Loading branch information
ronpal committed Oct 16, 2023
1 parent 865f090 commit a6e9290
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deploy modules

on:
push:
branches:
- ghactions

jobs:

build-modules:
runs-on: ubuntu-latest
name: Loadmaster
steps:
- uses: actions/checkout@v4

- name: Package step
uses: ./
id: build-package



27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# gcr.io/distroless/python3-debian11 (runtime env is using 3.9 and that's imporatant for native dependencies)
FROM python:3.9-slim AS builder

WORKDIR /

ENV PYTHONUNBUFFERED=1

# Poetry setup
RUN pip3 install poetry
RUN poetry config virtualenvs.create false

COPY poetry.lock .
COPY pyproject.toml .

RUN poetry config virtualenvs.create false
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
RUN pip3 install --target=/app -r requirements.txt --no-deps

# Keep the same folder structure for imports
COPY cognite/transformations_cli/ /app/cognite/transformations_cli/

# A distroless container image with Python and some basics like SSL certificates
# https://github.com/GoogleContainerTools/distroless
FROM gcr.io/distroless/python3-debian11
COPY --from=builder /app /app
ENV PYTHONPATH /app
ENTRYPOINT [ "python", "/app/build.py" ]
53 changes: 53 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Deploy to Transformations'
description: 'Deploy a set of transformations to Transformations from yaml manifests'
inputs:
api-key:
description: 'API key for authenticating with Transformations'
required: false
token-url:
description: 'Token url to use for fetching OAuth2 tokens'
required: false
cdf-project-name:
description: 'CDF project name (only required when using OAuth2 credentials)'
required: false
scopes:
description: 'List of OAuth2 scopes (space separated)'
required: false
audience:
description: 'OAuth2 audience'
required: false
client-id:
description: 'OAuth2 client ID'
required: false
client-secret:
description: 'OAuth2 client secret'
required: false
cluster:
description: 'CDF Cluster'
required: false
default: 'europe-west1-1'
path:
description: >-
The path to a directory containing transformation manifests.
This is relative to $GITHUB_WORKSPACE,
which will be the root of the repository when using actions/checkout with default settings.
required: true
legacy-mode:
description: 'Parse transformation manifests in legacy mode'
required: false
default: "false"
runs:
using: 'docker'
image: 'Dockerfile'
env:
TRANSFORMATIONS_API_KEY: ${{ inputs.api-key }}
TRANSFORMATIONS_TOKEN_URL: ${{ inputs.token-url }}
TRANSFORMATIONS_PROJECT: ${{ inputs.cdf-project-name }}
TRANSFORMATIONS_CLIENT_ID: ${{ inputs.client-id }}
TRANSFORMATIONS_CLIENT_SECRET: ${{ inputs.client-secret }}
TRANSFORMATIONS_SCOPES: ${{ inputs.scopes }}
TRANSFORMATIONS_AUDIENCE: ${{ inputs.audience }}
TRANSFORMATIONS_CLUSTER: "${{ inputs.cluster }}"
TRANSFORMATIONS_LEGACY_MODE: ${{ inputs.legacy-mode }}
args: ["deploy", "${{ inputs.path }}" , "--debug"]

0 comments on commit a6e9290

Please sign in to comment.