Review/cleanup Docker file and update dependencies #14 #64
Workflow file for this run
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
name: Build and Release | |
on: | |
push: | |
tags: | |
- "v*" | |
env: | |
# Any version upgrade for the osquery or kubectl should be done here | |
OSQUERY_VERSION: 5.14.1 | |
KUBECTL_VERSION: 1.31.3 | |
jobs: | |
build_and_release: | |
name: Build and Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Extract tagged Agent Docker Image version | |
id: image-version | |
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
- name: Debug - tag extraction | |
run: echo "Using transformed tag ${{ steps.image-version.outputs.version }}" | |
- name: Query the latest extension version | |
id: extension-version | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const query = ` | |
query { | |
repository(owner: "turbot", name: "steampipe-plugin-kubernetes") { | |
releases(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) { | |
nodes { | |
tagName | |
} | |
} | |
} | |
}`; | |
// Extract the latest version from the tag | |
const result = await github.graphql(query); | |
let tagName = result.repository.releases.nodes[0].tagName; | |
if (tagName.startsWith('v')) { | |
tagName = tagName.substring(1); | |
} | |
core.setOutput("version", tagName); | |
- name: Debug - query result | |
run: echo "Using transformed tag ${{ steps.extension-version.outputs.version }}" | |
- name: Versions used for the build | |
run: | | |
echo "DOCKER_VERSION=${{ steps.image-version.outputs.version }}" | |
echo "EXTENSION_VERSION=${{ steps.extension-version.outputs.version }}" | |
echo "OSQUERY_VERSION=${{ env.OSQUERY_VERSION }}" | |
echo "KUBECTL_VERSION=${{ env.KUBECTL_VERSION }}" | |
- name: Checkout Pipes repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push GitHub Container Registry | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./kubernetes/docker | |
push: true | |
platforms: linux/arm64,linux/amd64 | |
tags: | | |
ghcr.io/turbot/guardrails-agent-kubernetes:${{ steps.image-version.outputs.version }} | |
ghcr.io/turbot/guardrails-agent-kubernetes:latest | |
build-args: | | |
OSQUERY_VERSION=${{ env.OSQUERY_VERSION }} | |
KUBECTL_VERSION=${{ env.KUBECTL_VERSION }} | |
EXTENSION_VERSION=${{ steps.extension-version.outputs.version }} |