Skip to content

Commit

Permalink
Build and release a 'rootful' plugin
Browse files Browse the repository at this point in the history
See the top section in the readme for an explanation
  • Loading branch information
skoppe committed Sep 14, 2023
1 parent f474164 commit 05fffb7
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 277 deletions.
32 changes: 0 additions & 32 deletions .github/machinesetup.sh

This file was deleted.

111 changes: 28 additions & 83 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,35 @@
name: build
name: ci

on:
push:
workflow_dispatch:
workflow_call:

env:
PKG_NAME: "nomad-driver-podman"
on: push

jobs:
get-go-version:
name: "Determine Go toolchain version"
runs-on: ubuntu-20.04
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Determine Go version
id: get-go-version
run: |
echo "Building with Go $(cat .go-version)"
echo "::set-output name=go-version::$(cat .go-version)"
get-product-version:
runs-on: ubuntu-20.04
outputs:
product-version: ${{ steps.get-product-version.outputs.product-version }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: get product version
id: get-product-version
run: |
make version
echo "::set-output name=product-version::$(make version)"
generate-metadata-file:
needs: get-product-version
runs-on: ubuntu-20.04
outputs:
filepath: ${{ steps.generate-metadata-file.outputs.filepath }}
steps:
- name: "Checkout directory"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Generate metadata file
id: generate-metadata-file
uses: hashicorp/actions-generate-metadata@v1
with:
version: ${{ needs.get-product-version.outputs.product-version }}
product: ${{ env.PKG_NAME }}
repositoryOwner: "hashicorp"
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ !env.ACT }}
with:
name: metadata.json
path: ${{ steps.generate-metadata-file.outputs.filepath }}

build-linux:
needs:
- get-go-version
- get-product-version
runs-on: ubuntu-20.04
strategy:
matrix:
goos: ["linux"]
goarch: ["amd64", "arm64", "arm"]
fail-fast: true

name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build

docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push
uses: docker/build-push-action@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
load: true
push: false
tags: nomad-driver-podman/build:latest
-
name: build
run: |
make pkg/${{ matrix.goos }}_${{ matrix.goarch }}.zip
mv \
pkg/${{ matrix.goos }}_${{ matrix.goarch }}.zip \
${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ !env.ACT }}
docker cp $(docker create --name tc nomad-driver-podman/build:latest):/app/pkg/linux_amd64/nomad-driver-podman ./nomad-driver-podman-rootful && docker rm tc
tar -czf nomad-driver-podman-rootful.tar.gz -C nomad-driver-podman-rootful
sha256sum nomad-driver-podman-rootful.tar.gz | awk '{ print $1 }' > nomad-driver-podman-rootful.tar.gz.sha256
-
name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
files: |
nomad-driver-podman-rootful.tar.gz
nomad-driver-podman-rootful.tar.gz.sha256
123 changes: 0 additions & 123 deletions .github/workflows/nightly-release.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/tests.yml

This file was deleted.

6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM docker.io/golang

COPY . /app
WORKDIR /app

RUN make pkg/linux_amd64/nomad-driver-podman
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Fork
====

Unfortunately the `nomad-podman-driver` can only run either rootful or rootless.
We have actual needs to run some workloads rootfull, but want to run most of them rootless.

The workaround employed here is to fork the `nomad-podman-driver` and change the `pluginName` so that we
can register 2 podman plugins to Nomad, one configured to be rootful and the other to be rootless.

This happens on the `rootful` branch (this branch), where we also deploy from.

Normal readme follows:

Nomad podman Driver
==================

Expand Down
2 changes: 1 addition & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (

const (
// pluginName is the name of the plugin
pluginName = "podman"
pluginName = "podman-rootful"

// fingerprintPeriod is the interval at which the driver will send fingerprint responses
fingerprintPeriod = 30 * time.Second
Expand Down

0 comments on commit 05fffb7

Please sign in to comment.