-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add apko/build command to the orb (#14)
Co-authored-by: Justin Burr <juburr@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
101 additions
and
2 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
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,25 @@ | ||
description: Builds a container using apko. | ||
parameters: | ||
config_path: | ||
type: string | ||
description: Path to a the YAML configuration file. | ||
image_uri: | ||
type: string | ||
description: Image and tag of the output container image. | ||
log_level: | ||
type: enum | ||
enum: ["debug", "info", "warn", "error", "fatal", "panic"] | ||
default: "debug" | ||
description: Logging level to use. | ||
output_path: | ||
type: string | ||
description: Output filename for the final TAR file. | ||
steps: | ||
- run: | ||
name: Build Apko Image | ||
environment: | ||
PARAM_CONFIG_PATH: << parameters.config_path >> | ||
PARAM_IMAGE_URI: << parameters.image_uri >> | ||
PARAM_LOG_LEVEL: << parameters.log_level >> | ||
PARAM_OUTPUT_PATH: << parameters.output_path >> | ||
command: << include(scripts/build.sh) >> |
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,40 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Ensure CircleCI environment variables can be passed in as orb parameters | ||
CONFIG_PATH=$(circleci env subst "${PARAM_CONFIG_PATH}") | ||
IMAGE_URI=$(circleci env subst "${PARAM_IMAGE_URI}") | ||
LOG_LEVEL=$(circleci env subst "${PARAM_LOG_LEVEL}") | ||
OUTPUT_PATH=$(circleci env subst "${PARAM_OUTPUT_PATH}") | ||
|
||
# Computed parameters | ||
OUTPUT_DIR=$(dirname "${OUTPUT_PATH}") | ||
|
||
# Print command parameters for debugging purposes. | ||
echo "Running Apko build with the following parameters:" | ||
echo " CONFIG_PATH: ${CONFIG_PATH}" | ||
echo " IMAGE_URI: ${IMAGE_URI}" | ||
echo " LOG_LEVEL: ${LOG_LEVEL}" | ||
echo " OUTPUT_DIR: ${OUTPUT_DIR}" | ||
echo " OUTPUT_PATH: ${OUTPUT_PATH}" | ||
echo "" | ||
|
||
# Validate configuration YAML file path | ||
if [[ ! -f "${CONFIG_PATH}" ]]; then | ||
echo "Configuration YAML does not exist at: ${CONFIG_PATH}" | ||
exit 1 | ||
fi | ||
|
||
# Create output directory if it does not yet exist | ||
if [[ -d "${OUTPUT_DIR}" ]]; then | ||
echo "Output directory already exists: ${OUTPUT_DIR}" | ||
else | ||
echo "Creating directory ${OUTPUT_DIR}..." | ||
mkdir -p "${OUTPUT_DIR}" | ||
echo " Done." | ||
fi | ||
|
||
# Build image | ||
echo "Building container image with apko..." | ||
apko build --log-level "${LOG_LEVEL}" "${CONFIG_PATH}" "${IMAGE_URI}" "${OUTPUT_PATH}" |
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,22 @@ | ||
contents: | ||
keyring: | ||
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub | ||
repositories: | ||
- https://packages.wolfi.dev/os | ||
packages: | ||
- ca-certificates-bundle | ||
- gdal-tools | ||
- glibc | ||
- openssl | ||
- tzdata | ||
|
||
accounts: | ||
groups: | ||
- groupname: nonroot | ||
gid: 65532 | ||
users: | ||
- username: nonroot | ||
uid: 65532 | ||
|
||
archs: | ||
- amd64 |