Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
Merge branch 'on-premise-mail' of https://github.com/SAP/xsk into on-…
Browse files Browse the repository at this point in the history
…premise-mail
  • Loading branch information
d-velev committed Apr 27, 2022
2 parents 9a40e0a + 718999f commit 0dc48a5
Show file tree
Hide file tree
Showing 34 changed files with 2,695 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Set Multi-Builder Docker Buildx
run: docker buildx create --use --name multi-builder --platform linux/arm64,linux/amd64
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
Expand Down Expand Up @@ -63,6 +65,16 @@ jobs:
docker build --load -t dirigiblelabs/xsk-kyma --build-arg JDK_TYPE=external-jdk --build-arg JDK_HOME=jdk .
docker push dirigiblelabs/xsk-kyma
cd ../../
- name: Push XSK for SAP Kyma Runtime
run: |
cd releng/sap-kyma-runtime
docker build --load -t dirigiblelabs/xsk-kyma-runtime-base -f Dockerfile-base .
docker push dirigiblelabs/xsk-kyma-runtime-base
docker build --load -t dirigiblelabs/xsk-kyma-runtime .
docker push dirigiblelabs/xsk-kyma-runtime
docker build --load -t dirigiblelabs/xsk-kyma-runtime-distro -f Dockerfile-distro .
docker push dirigiblelabs/xsk-kyma-runtime-distro
cd ../../
- uses: buildpacks/github-actions/[email protected]
- name: XSK Buildpack
run: |
Expand Down Expand Up @@ -96,6 +108,22 @@ jobs:
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma --config ./builder.toml
docker push dirigiblelabs/buildpacks-builder-xsk-kyma
cd ../../../../
- name: XSK Kyma Runtime Buildpack
run: |
cd releng/buildpacks/xsk-kyma-runtime/
docker build --load -t dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime . --target base
docker push dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime
docker build --load -t dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime . --target run
docker push dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime
docker build --load -t dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime . --target build
docker push dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/latest/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma-runtime --config ./package.toml
docker push dirigiblelabs/buildpacks-xsk-kyma-runtime
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma-runtime --config ./builder.toml
docker push dirigiblelabs/buildpacks-builder-xsk-kyma-runtime
cd ../../../../
- name: XSK Cloud Foundry Buildpack
run: |
cd releng/buildpacks/xsk-cf/
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Set Multi-Builder Docker Buildx
run: docker buildx create --use --name multi-builder --platform linux/arm64,linux/amd64
- name: Maven Build
run: mvn clean install
- name: Docker Login
Expand All @@ -72,6 +74,16 @@ jobs:
docker build --load -t dirigiblelabs/xsk-kyma:${{ env.XSK_VERSION }} --build-arg JDK_TYPE=external-jdk --build-arg JDK_HOME=jdk .
docker push dirigiblelabs/xsk-kyma:${{ env.XSK_VERSION }}
cd ../../
- name: Push XSK for SAP Kyma Runtime
run: |
cd releng/sap-kyma-runtime
docker build --load -t dirigiblelabs/xsk-kyma-runtime-base -f Dockerfile-base .
docker push dirigiblelabs/xsk-kyma-runtime-base
docker build --load -t dirigiblelabs/xsk-kyma-runtime .
docker push dirigiblelabs/xsk-kyma-runtime
docker build --load -t dirigiblelabs/xsk-kyma-runtime-distro -f Dockerfile-distro .
docker push dirigiblelabs/xsk-kyma-runtime-distro
cd ../../
- uses: buildpacks/github-actions/[email protected]
- name: XSK Buildpack
run: |
Expand Down Expand Up @@ -115,6 +127,22 @@ jobs:
docker tag dirigiblelabs/buildpacks-builder-xsk-kyma dirigiblelabs/buildpacks-builder-xsk-kyma:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-builder-xsk-kyma:${{ env.XSK_VERSION }}
cd ../../../../
- name: XSK Kyma Runtime Buildpack
run: |
cd releng/buildpacks/xsk-kyma-runtime/
docker build --load -t dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime . --target base
docker push dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime
docker build --load -t dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime . --target run
docker push dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime
docker build --load -t dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime . --target build
docker push dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/latest/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma-runtime --config ./package.toml
docker push dirigiblelabs/buildpacks-xsk-kyma-runtime
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma-runtime --config ./builder.toml
docker push dirigiblelabs/buildpacks-builder-xsk-kyma-runtime
cd ../../../../
- name: XSK Cloud Foundry Buildpack
run: |
cd releng/buildpacks/xsk-cf/
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ jobs:
cp -r "${JAVA_HOME}" jdk
docker build -t dirigiblelabs/xsk-kyma --build-arg JDK_TYPE=external-jdk --build-arg JDK_HOME=jdk .
cd ../../
- name: Push XSK for SAP Kyma Runtime
run: |
cd releng/sap-kyma-runtime
docker build -t dirigiblelabs/xsk-kyma-runtime-base -f Dockerfile-base .
docker build -t dirigiblelabs/xsk-kyma-runtime .
docker build -t dirigiblelabs/xsk-kyma-runtime-distro -f Dockerfile-distro .
cd ../../
- uses: buildpacks/github-actions/[email protected]
- name: XSK Buildpack
run: |
Expand All @@ -80,6 +87,17 @@ jobs:
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma --config ./package.toml
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma --config ./builder.toml
cd ../../../../
- name: XSK Kyma Runtime Buildpack
run: |
cd releng/buildpacks/xsk-kyma-runtime/
docker build -t dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime . --target base
docker build -t dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime . --target run
docker build -t dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime . --target build
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/latest/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma-runtime --config ./package.toml
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma-runtime --config ./builder.toml
cd ../../../../
- name: XSK Cloud Foundry Buildpack
run: |
cd releng/buildpacks/xsk-cf/
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Set Multi-Builder Docker Buildx
run: docker buildx create --use --name multi-builder --platform linux/arm64,linux/amd64
- name: Maven Build
run: mvn clean install
- name: Docker Login
Expand All @@ -58,6 +60,16 @@ jobs:
docker build --load -t dirigiblelabs/xsk-kyma:${{ env.XSK_VERSION }} --build-arg JDK_TYPE=external-jdk --build-arg JDK_HOME=jdk .
docker push dirigiblelabs/xsk-kyma:${{ env.XSK_VERSION }}
cd ../../
- name: Push XSK for SAP Kyma Runtime
run: |
cd releng/sap-kyma-runtime
docker build --load -t dirigiblelabs/xsk-kyma-runtime-base -f Dockerfile-base .
docker push dirigiblelabs/xsk-kyma-runtime-base
docker build --load -t dirigiblelabs/xsk-kyma-runtime .
docker push dirigiblelabs/xsk-kyma-runtime
docker build --load -t dirigiblelabs/xsk-kyma-runtime-distro -f Dockerfile-distro .
docker push dirigiblelabs/xsk-kyma-runtime-distro
cd ../../
- uses: buildpacks/github-actions/[email protected]
- name: XSK Buildpack
run: |
Expand Down Expand Up @@ -101,6 +113,22 @@ jobs:
docker tag dirigiblelabs/buildpacks-builder-xsk-kyma dirigiblelabs/buildpacks-builder-xsk-kyma:${{ env.XSK_VERSION }}
docker push dirigiblelabs/buildpacks-builder-xsk-kyma:${{ env.XSK_VERSION }}
cd ../../../../
- name: XSK Kyma Runtime Buildpack
run: |
cd releng/buildpacks/xsk-kyma/
docker build --load -t dirigiblelabs/buildpacks-stack-base-xsk-kyma . --target base
docker push dirigiblelabs/buildpacks-stack-base-xsk-kyma
docker build --load -t dirigiblelabs/buildpacks-stack-run-xsk-kyma . --target run
docker push dirigiblelabs/buildpacks-stack-run-xsk-kyma
docker build --load -t dirigiblelabs/buildpacks-stack-build-xsk-kyma . --target build
docker push dirigiblelabs/buildpacks-stack-build-xsk-kyma
cd buildpack/
find *.toml -type f -exec sed -i ''s/#{XSKVersion}#/latest/g'' {} \;
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma --config ./package.toml
docker push dirigiblelabs/buildpacks-xsk-kyma
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma --config ./builder.toml
docker push dirigiblelabs/buildpacks-builder-xsk-kyma
cd ../../../../
- name: XSK Cloud Foundry Buildpack
run: |
cd releng/buildpacks/xsk-cf/
Expand Down
1 change: 1 addition & 0 deletions releng/buildpacks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<modules>
<module>xsk</module>
<module>xsk-kyma</module>
<module>xsk-kyma-runtime</module>
<module>xsk-cf</module>
</modules>

Expand Down
31 changes: 31 additions & 0 deletions releng/buildpacks/xsk-kyma-runtime/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Docker descriptor for XSK
# Copyright (c) 2022 SAP SE or an SAP affiliate company and XSK contributors

# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, v2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0

# SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and XSK contributors
# SPDX-License-Identifier: Apache-2.0

FROM dirigiblelabs/xsk-kyma-runtime as base

ENV CNB_USER_ID=1000
ENV CNB_GROUP_ID=1000
ENV CNB_STACK_ID="com.sap.kneo.xsk"
LABEL io.buildpacks.stack.id="com.sap.kneo.xsk"

RUN groupadd cnb --gid ${CNB_GROUP_ID} && \
useradd --uid ${CNB_USER_ID} --gid ${CNB_GROUP_ID} -m -s /bin/bash cnb
RUN chown -R cnb:cnb /usr/local/tomcat

FROM base as run

USER ${CNB_USER_ID}:${CNB_GROUP_ID}
RUN chown -R cnb:cnb /usr/local/tomcat

FROM base as build

USER ${CNB_USER_ID}:${CNB_GROUP_ID}
RUN chown -R cnb:cnb /usr/local/tomcat
94 changes: 94 additions & 0 deletions releng/buildpacks/xsk-kyma-runtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
## XSK Kyma Buildpack

1. Set the XSK version:
> Replace the `#{XSKVersion}#` placeholder (e.g. `latest`, `0.7.1`, `1.0.0`) in `buildpack/*.toml` files.
1. Build `XSK Kyma Stack`:

```
docker build -t dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime . --target base
docker push dirigiblelabs/buildpacks-stack-base-xsk-kyma-runtime
docker build -t dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime . --target run
docker push dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime
docker build -t dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime . --target build
docker push dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime
```
1. Build `XSK Kyma Buildpack`:
```
cd buildpack/
pack buildpack package dirigiblelabs/buildpacks-xsk-kyma-runtime --config ./package.toml
docker push dirigiblelabs/buildpacks-xsk-kyma-runtime
pack builder create dirigiblelabs/buildpacks-builder-xsk-kyma-runtime --config ./builder.toml
docker push dirigiblelabs/buildpacks-builder-xsk-kyma-runtime
```
1. Usage with `pack`:
```
pack build --builder dirigiblelabs/buildpacks-builder-xsk-kyma-runtime <my-org>/<my-repository>
```
## Kpack Installation
1. [Install Pack](https://buildpacks.io/docs/tools/pack/#install)
1. [Install Kpack](https://github.com/pivotal/kpack/blob/main/docs/install.md)
1. [Install logging tool](https://github.com/pivotal/kpack/blob/main/docs/logs.md)
1. Create Docker Registry Secret:
```
kubectl create secret docker-registry docker-registry-secret \
--docker-username=<your-username> \
--docker-password=<your-password> \
--docker-server=https://index.docker.io/v1/ \
--namespace default
```
1. Create Service Account
```
kubectl apply -f service-account.yaml
```
1. Create `ClusterStore`, `ClusterStack` and `Builder`:
```
kubectl apply -f kpack.yaml
```
> _**Note:** Before creating the Kpack resources, replace the **`<tag>`** placeholder with a valid XSK version (e.g. 0.5.0, 0.6.0, ...). All available XSK versions could be found [here](https://github.com/SAP/xsk/releases) and the respective Docker images [here](https://hub.docker.com/r/dirigiblelabs/kneo-xsk-buildpack/tags?page=1&ordering=last_updated)._
## Image Building
1. Create Image:
```yaml
apiVersion: kpack.io/v1alpha1
kind: Image
metadata:
name: xsk-application
namespace: default
spec:
tag: dirigiblelabs/xsk-application:<tag>
serviceAccount: docker-registry-service-account
imageTaggingStrategy: <tag>
builder:
name: xsk-builder
kind: Builder
source:
blob:
url: https://github.com/SAP/xsk/raw/main/samples/xsjs-simple.zip
```
> _**Note:** Replace the **`<tag>`** placeholder with your Docker image tag._
1. Monitor Logs:
```
logs -image xsk-application -namespace default
```
Binary file not shown.
29 changes: 29 additions & 0 deletions releng/buildpacks/xsk-kyma-runtime/buildpack/bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -eo pipefail

echo "Building ..."

echo "Projects to be imported:"
for n in *; do printf ' - %s\n' "$n"; done

echo "Copy projects ..."
mkdir -p /usr/local/tomcat/target/dirigible/repository/root/registry/public/
cp -R * /usr/local/tomcat/target/dirigible/repository/root/registry/public/
cp -R /usr/local/tomcat/target/ /workspace/target
rm -rf /usr/local/tomcat/target/

echo "Imported Projects:"
cd /workspace/target/dirigible/repository/root/registry/public/
for n in *; do printf ' - %s\n' "$n"; done

# 1. GET ARGS
layersdir=$1

# ========== ADDED ===========
# 8. SET DEFAULT START COMMAND
cat > "$layersdir/launch.toml" <<EOL
[[processes]]
type = "web"
command = "/usr/local/tomcat/bin/catalina.sh run"
EOL

5 changes: 5 additions & 0 deletions releng/buildpacks/xsk-kyma-runtime/buildpack/bin/detect
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -eo pipefail

echo "Detecting ... "
13 changes: 13 additions & 0 deletions releng/buildpacks/xsk-kyma-runtime/buildpack/builder.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Buildpacks to include in builder
[[buildpacks]]
uri = "."

[[order]]
[[order.group]]
id = "dirigiblelabs/buildpacks-xsk-kyma-runtime"
version = "#{XSKVersion}#"

[stack]
id = "com.sap.kneo.xsk"
build-image = "dirigiblelabs/buildpacks-stack-build-xsk-kyma-runtime"
run-image = "dirigiblelabs/buildpacks-stack-run-xsk-kyma-runtime"
12 changes: 12 additions & 0 deletions releng/buildpacks/xsk-kyma-runtime/buildpack/buildpack.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Buildpack API version
api = "0.5"

# Buildpack ID and metadata
[buildpack]
id = "dirigiblelabs/buildpacks-xsk-kyma-runtime"
version = "#{XSKVersion}#"
name = "XSK Kyma Buildpack"

# Stacks that the buildpack will work with
[[stacks]]
id = "com.sap.kneo.xsk"
3 changes: 3 additions & 0 deletions releng/buildpacks/xsk-kyma-runtime/buildpack/package.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[buildpack]
uri = "."

Loading

0 comments on commit 0dc48a5

Please sign in to comment.