Skip to content

Commit 552b701

Browse files
committed
ci: harden release packaging
1 parent 26ba5ce commit 552b701

10 files changed

Lines changed: 434 additions & 397 deletions

.devops/cpu.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ COPY --from=build /app/full/llama-server /app
104104

105105
WORKDIR /app
106106

107+
RUN /app/llama-server --version
108+
107109
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
108110

109111
ENTRYPOINT [ "/app/llama-server" ]

.devops/cuda.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ COPY --from=build /app/full/llama-server /app
128128

129129
WORKDIR /app
130130

131+
RUN /app/llama-server --version
132+
131133
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
132134

133135
ENTRYPOINT [ "/app/llama-server" ]

.devops/intel.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ COPY --from=build /app/full/llama-server /app
149149

150150
WORKDIR /app
151151

152+
RUN /app/llama-server --version
153+
152154
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
153155

154156
ENTRYPOINT [ "/app/llama-server" ]

.devops/rocm.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ COPY --from=build /app/full/llama-server /app
132132

133133
WORKDIR /app
134134

135+
RUN /app/llama-server --version
136+
135137
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
136138

137139
ENTRYPOINT [ "/app/llama-server" ]

.devops/vulkan.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ COPY --from=build /app/full/llama-server /app
118118

119119
WORKDIR /app
120120

121+
RUN /app/llama-server --version
122+
121123
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
122124

123125
ENTRYPOINT [ "/app/llama-server" ]

.github/workflows/docker.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@ name: Publish Docker image
33
on:
44
push:
55
branches:
6-
- main
76
- "v*"
87
tags:
98
- "v*"
109
workflow_dispatch:
10+
inputs:
11+
tag_name:
12+
description: "Docker release tag name to use, for example v0.3.0"
13+
required: false
14+
type: string
15+
publish_release_tags:
16+
description: "Publish stable release Docker tags for tag_name"
17+
required: false
18+
default: false
19+
type: boolean
1120

1221
concurrency:
1322
group: ${{ github.workflow }}-${{ github.ref }}
@@ -44,6 +53,8 @@ jobs:
4453
release="false"
4554
short_sha="${GITHUB_SHA::12}"
4655
exact_tag="$(git tag --points-at "${GITHUB_SHA}" --list 'v*' | sort -V | tail -n 1 || true)"
56+
input_tag_name="${INPUT_TAG_NAME:-}"
57+
input_publish_release_tags="${INPUT_PUBLISH_RELEASE_TAGS:-false}"
4758
ref_name_safe="$(printf '%s' "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | sed -E 's#[^a-z0-9_.-]+#-#g; s#^[.-]+##; s#[.-]+$##')"
4859
if [[ -z "${ref_name_safe}" ]]; then
4960
ref_name_safe="${short_sha}"
@@ -62,11 +73,29 @@ jobs:
6273
version="${exact_tag}"
6374
publish="true"
6475
release="true"
65-
elif [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == refs/heads/v* ]]; then
76+
elif [[ "${GITHUB_REF}" == refs/heads/v* ]]; then
6677
version="${ref_name_safe}-${short_sha}"
6778
publish="true"
6879
elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
69-
version="${ref_name_safe}-${short_sha}"
80+
if [[ -n "${input_tag_name}" ]]; then
81+
if [[ "${input_tag_name}" != v* ]]; then
82+
echo "Manual release Docker publishing requires a v* tag_name input." >&2
83+
exit 1
84+
fi
85+
version="${input_tag_name}"
86+
release="${input_publish_release_tags}"
87+
if [[ "${release}" == "true" ]]; then
88+
git fetch origin +refs/heads/main:refs/remotes/origin/main --no-tags
89+
git fetch origin +refs/tags/"${input_tag_name}":refs/tags/"${input_tag_name}"
90+
tag_commit="$(git rev-list -n 1 "${input_tag_name}")"
91+
if ! git merge-base --is-ancestor "${tag_commit}" refs/remotes/origin/main; then
92+
echo "Tag ${input_tag_name} is not on origin/main; refusing to publish release Docker tags." >&2
93+
exit 1
94+
fi
95+
fi
96+
else
97+
version="${ref_name_safe}-${short_sha}"
98+
fi
7099
publish="true"
71100
else
72101
version="${ref_name_safe}-${short_sha}"
@@ -86,6 +115,9 @@ jobs:
86115
echo "Using version: ${version}"
87116
echo "Publish Docker images: ${publish}"
88117
echo "Release Docker tags: ${release}"
118+
env:
119+
INPUT_TAG_NAME: ${{ inputs.tag_name || '' }}
120+
INPUT_PUBLISH_RELEASE_TAGS: ${{ inputs.publish_release_tags }}
89121

90122
build:
91123
name: Build server${{ matrix.config.display_suffix }}

.github/workflows/release-publish-existing.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)