Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build container management as a static binary #91

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: if [ ${GITHUB_REF#refs/heads/} == "main" ]; then echo "BRANCH_NAME=$(echo "nanbield")" >>$GITHUB_ENV; else echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_ENV; fi
run: if [ ${GITHUB_REF#refs/heads/} == "main" ]; then echo "BRANCH_NAME=$(echo "scarthgap")" >>$GITHUB_ENV; else echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_ENV; fi
id: get_branch
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: if [ ${{ github.event.pull_request.base.ref }} == "main" ]; then echo "BRANCH_NAME=$(echo "nanbield")" >>$GITHUB_ENV; else echo "BRANCH_NAME=$(echo ${{ github.event.pull_request.base.ref }})" >>$GITHUB_ENV; fi
run: if [ ${{ github.event.pull_request.base.ref }} == "main" ]; then echo "BRANCH_NAME=$(echo "scarthgap")" >>$GITHUB_ENV; else echo "BRANCH_NAME=$(echo ${{ github.event.pull_request.base.ref }})" >>$GITHUB_ENV; fi
id: get_branch_pr
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion conf/layer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ LAYERDEPENDS_meta-kanto = " \
virtualization-layer \
"

LAYERSERIES_COMPAT_meta-kanto = "langdale mickledore nanbield"
LAYERSERIES_COMPAT_meta-kanto = "scarthgap"

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ GO_INSTALL = "${GO_IMPORT}/containerm/daemon \
${GO_IMPORT}/containerm/cli \
"

GO_LINKSHARED = ""
GOBUILDFLAGS:remove = "-buildmode=pie"

require container-management.inc

inherit go-mod
Expand Down Expand Up @@ -48,6 +51,12 @@ FILES:${PN} += "${CM_BIN_DD}/container-management ${CM_BIN_DD}/kanto-cm"
# ensure all additional resources are properly packed in the resulting package if provided
FILES:${PN} += "${CM_CFG_DD}/container-management/config.json"

# VERSION_PKG = "github.com/eclipse-kanto/container-management/containerm"
# BUILD_TIME = "${@time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime())}"
# BUILD_VERSION = "0.1.0-M2"
# BUILD_REVISION = "${@'${SRCREV}'[:7]}"
# export GO_EXTRA_LDFLAGS="-X ${VERSION_PKG}/version.GitCommit=${BUILD_REVISION} -X ${VERSION_PKG}/version.ProjectVersion=${BUILD_VERSION} -X ${VERSION_PKG}/version.APIVersion=${BUILD_VERSION} -X ${VERSION_PKG}/version.BuildTime=${BUILD_TIME}"

do_install() {
install -d ${D}/${CM_BIN_DD}

Expand Down Expand Up @@ -95,4 +104,4 @@ RDEPENDS:${PN} += "kernel-module-dm-thin-pool kernel-module-nf-nat kernel-module
KERNEL_MODULE_AUTOLOAD += "xt_conntrack xt_addrtype"

PROVIDES:${PN} += "kanto/container-management"
RPROVIDES:${PN} += "kanto/container-management"
RPROVIDES:${PN} += "kanto/container-management"
11 changes: 7 additions & 4 deletions recipes-containers/container-management/files/service.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
Description=Eclipse Kanto - Container Management
Documentation=https://eclipse.org/kanto/docs/
After=network.target containerd.service
Requires=network.target containerd.service
Requires=network.target
Requires=containerd.service

[Service]
Type=simple
ExecStart=@CM_BIN_DD@/container-management --cfg-file @CM_CFG_DD@/container-management/config.json
Environment=HOME=%h
Environment=XDG_CONFIG_HOME=%E
ExecStart=/usr/bin/container-management --cfg-file /etc/container-management/config.json
Restart=always
TimeoutSec=3000
TimeoutSec=300

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
Loading