-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework pipeline and surrounding scripts (#13)
* restructure pipeline and surrounding scripting * add blueprint to component
- Loading branch information
1 parent
0242090
commit 4d0a1f1
Showing
40 changed files
with
821 additions
and
267 deletions.
There are no files selected for viewing
This file contains 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,51 @@ | ||
#!/bin/bash -eu | ||
|
||
PROJECT_ROOT="$(dirname $(realpath $0))/.." | ||
if [[ -z ${LOCALBIN:-} ]]; then | ||
LOCALBIN="$PROJECT_ROOT/bin" | ||
fi | ||
if [[ -z ${HELM:-} ]]; then | ||
HELM="$LOCALBIN/helm" | ||
fi | ||
|
||
"$PROJECT_ROOT/.ci/ensure-make" | ||
|
||
( | ||
cd "${PROJECT_ROOT}" | ||
|
||
echo "Run 'make helm' ..." | ||
make helm | ||
|
||
echo "Fetch registry credentials ..." | ||
creds="$(cli.py config attribute --cfg-type container_registry --cfg-name laas-component-descriptor-pipeline --key password)" | ||
|
||
echo "Authenticate helm against artifact registry ..." | ||
"$HELM" registry login -u _json_key --password-stdin https://europe-docker.pkg.dev <<< "$creds" | ||
|
||
echo "Run 'make helm-chart' ..." | ||
make helm-chart | ||
|
||
echo "Authenticate docker against artifact registry ..." | ||
docker login -u _json_key --password-stdin https://europe-docker.pkg.dev <<< "$creds" | ||
|
||
echo "Create OCM config ..." | ||
cat << EOF > "$HOME/.ocmconfig" | ||
type: generic.config.ocm.software/v1 | ||
configurations: | ||
- type: credentials.config.ocm.software | ||
repositories: | ||
- repository: | ||
type: DockerConfig/v1 | ||
dockerConfigFile: "~/.docker/config.json" | ||
propagateConsumerIdentity: true | ||
EOF | ||
|
||
echo "Run 'make component-build' ..." | ||
make component-build | ||
echo "Component successfully built." | ||
|
||
echo "Run 'make component-push' ..." | ||
export OVERWRITE_COMPONENTS="true" | ||
make component-push | ||
echo "Component successfully pushed." | ||
) |
This file contains 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 |
---|---|---|
@@ -1,29 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
#!/bin/bash -eu | ||
|
||
from pathlib import Path | ||
import os | ||
import yaml | ||
# creates a dummy component descriptor | ||
|
||
project_root = Path(__file__).parent.parent | ||
in_path = os.getenv("BASE_DEFINITION_PATH") | ||
out_path = os.getenv("COMPONENT_DESCRIPTOR_PATH") | ||
version = os.getenv("EFFECTIVE_VERSION") | ||
PROJECT_ROOT="$(dirname $(realpath $0))/.." | ||
HACK_DIR="$PROJECT_ROOT/hack" | ||
|
||
def read_data(path: str) -> str: | ||
with open(path, "r") as file: | ||
return file.read() | ||
VERSION="$($HACK_DIR/get-version.sh)" | ||
COMPONENT_REGISTRY="$($HACK_DIR/get-registry.sh --component)" | ||
|
||
cd = yaml.safe_load(read_data(in_path)) | ||
cd["component"]["resources"].append({ | ||
"name": "chart", | ||
"type": "helmChart", | ||
"version": version, | ||
"input": { | ||
"type": "helm", | ||
"path": str(project_root.joinpath("charts", "k8syncer")), | ||
"repository": "/charts" | ||
} | ||
}) | ||
|
||
with open(out_path, "w") as file: | ||
yaml.safe_dump(cd, stream=file, default_flow_style=False) | ||
cat << EOF > "$COMPONENT_DESCRIPTOR_PATH" | ||
component: | ||
componentReferences: [] | ||
name: github.com/gardener/dummy | ||
provider: sap.com | ||
repositoryContexts: | ||
- baseUrl: ${COMPONENT_REGISTRY%%/*} | ||
componentNameMapping: urlPath | ||
subPath: ${COMPONENT_REGISTRY#*/} | ||
type: OCIRegistry | ||
resources: [] | ||
sources: [] | ||
version: v0.0.0-dummy | ||
meta: | ||
schemaVersion: v2 | ||
EOF |
This file contains 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,6 @@ | ||
#!/bin/bash -eu | ||
|
||
if ! which make 1>/dev/null; then | ||
echo "> Installing make ..." | ||
apk add make 1>/dev/null | ||
fi |
This file contains 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 @@ | ||
#!/bin/bash -eu | ||
|
||
PROJECT_ROOT="$(dirname $(realpath $0))/.." | ||
COMPONENT_NAME="k8syncer" | ||
IMAGE_REPO="$($PROJECT_ROOT/hack/get-registry.sh --image)/${COMPONENT_NAME}" | ||
|
||
"${PROJECT_ROOT}/.ci/prepare-docker" | ||
"${PROJECT_ROOT}/.ci/ensure-make" | ||
|
||
( | ||
cd "${PROJECT_ROOT}" | ||
if [[ "$EFFECTIVE_VERSION" == *dev* ]]; then | ||
export ADDITIONAL_TAG="dev-$EFFECTIVE_VERSION" | ||
else | ||
export ADDITIONAL_TAG="latest" | ||
fi | ||
make docker-buildx | ||
) |
This file contains 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 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,12 @@ | ||
#!/bin/bash -eu | ||
|
||
PROJECT_ROOT="$(dirname $(realpath $0))/.." | ||
COMPONENT_NAME="k8syncer" | ||
IMAGE_PREFIX="$($PROJECT_ROOT/hack/get-registry.sh)/${COMPONENT_NAME}" | ||
|
||
# start docker daemon | ||
launch-dockerd.sh | ||
|
||
# configure credentials | ||
mkdir -p "$HOME/.docker" | ||
gardener-ci docker cfg --image "$IMAGE_PREFIX" > $HOME/.docker/config.json |
This file contains 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 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 |
---|---|---|
@@ -1,16 +1,9 @@ | ||
#!/bin/bash | ||
#!/bin/bash -eu | ||
|
||
# SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and Gardener contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
PROJECT_ROOT="$(dirname $(realpath $0))/.." | ||
( | ||
cd "${PROJECT_ROOT}" | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
cd "$(dirname $0)/.." | ||
|
||
make install-requirements | ||
|
||
make verify | ||
make test | ||
make verify | ||
make test | ||
) |
This file contains 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 |
---|---|---|
|
@@ -18,4 +18,5 @@ coverage.* | |
.vscode | ||
.DS_Store | ||
|
||
tmp | ||
tmp/ | ||
bin/ |
This file contains 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
Oops, something went wrong.