Drone plugin to run melange melange
IMPORTANT:
- This plugin is under development and the parameters are subject to change
- Currently only basic options of melange are supported. Plan to add options on need basis.
The following settings changes this plugin's behavior,
config_file
: The melange configuration YAML file, path relative to drone pipeline.output_dir
: The directory where the built packages will be saved. Defaults to$DRONE_WORKSPACE/packages
archs
: Thelinux
architecture for which the packages will be built. Defaults$(uname -m)
. Valid values are:amd64
,arm64
.signing_key
: The signing key that will be used to sign the package. If not provided it will be generated.env_file
: The environment file that will be preloaded and made available to build environment.
kind: pipeline
type: docker
name: default
steps:
- name: build image
image: kameshsampath/melange-drone-plugin
privileged: true
settings:
config_file: melange.yaml
archs:
- amd64
- arm64
IMPORTANT: Since melange spins lightweight containers while building, it is required to run the pipeline as privileged: true
Checkout examples in folder examples. You need to have drone CLI to execute the examples locally.
Example | Description |
---|---|
All Architectures | Builds packages for all supported architectures, 386 , amd64 , arm64 , arm/v6 , arm/v7 , ppc64le ,riscv64 ,s390x . |
Defaults | Build package for default host architecture uname -m |
Multiple Architectures | Builds packages for specific architectures. |
Output Directory | Generates the packages in custom directory relative to drone pipeline |
Using Signing Key | Build and sign the packages using configured signing key |
The plugin relies on apko and melange for build.
The plugin build relies on:
Start lima-vm
environment,
task build_env
Build plugin packages,
task packages
Build plugin container image,
task image
To publish the plugin to remote repository use,
task publish_plugin
Build plugin container image,
task clean image load
Create .env
cat<<EOF | tee .env
PLUGIN_ARCHS=amd64,arm64
PLUGIN_CONFIG_FILE=melange.yaml
EOF
Create a melange.yaml
,
cat<<EOF | tee melange.yaml
---
package:
name: go-hello-world
version: 0.0.2
epoch: 0
description: "a simple hello world rest api used for demos"
target-architecture:
- amd64
-
copyright:
- paths:
- "*"
attestation: TODO
license: Apache License 2.0
dependencies:
runtime:
environment:
contents: {}
packages:
- go
pipeline:
- uses: go/install
with:
package: github.com/kameshsampath/go-hello-world
version: v\${{package.version}}
- uses: strip
EOF
docker run --privileged --rm \
--env-file=.env \
--volume "$PWD:/workspace" \
kameshsampath/melange-drone-plugin:latest
After the successful build you can can see the packages created in $PWD/dist
.