Skip to content

Commit 4b9417f

Browse files
Merge pull request #686 from PeterYurkovich/ou-1081
OU-1081: allow claude-code to build-images
2 parents fe667e7 + 9ef80c9 commit 4b9417f

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

.claude/commands/build-images.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: build-images
3+
description:
4+
parameters:
5+
- tag: The tag to be placed on the created images. This will typically be a jira ticket in the format of "letters-numbers" (ie. OU-1111).
6+
allowed-tools: Bash(INTERACTIVE=0 TAG=* make build-image), Bash(INTERACTIVE=0 TAG=* make build-dev-mcp-image), Bash(podman image ls -f "reference=$REGISTRY_ORG/monitoring-plugin*"), Bash(podman image ls -f "reference=$REGISTRY_ORG/monitoring-console-plugin*")
7+
---
8+
9+
## Context
10+
11+
- Prefer podman when running image related commands over docker.
12+
- All images that have currently been built for the monitoring plugin: !`podman image ls -f "reference=$REGISTRY_ORG/monitoring-plugin*"`
13+
- All images that have currently been built for the monitoring console plugin: !`podman image ls -f "reference=$REGISTRY_ORG/monitoring-plugin*"`
14+
- Scripting used: @Makefile @scripts/build-image.sh
15+
16+
## Your task
17+
18+
Determine an appropriate non-duplicate image tag to use. If the current git branch is a jira issue then you should use that as the base. If the tag is not already used then use it directly. If it has already been used, then add an additional index to the tag and increment one past the highest existing value. For example, if tags [OU-1111, OU-1111-2, and OU-1111-3] already exist then the the non-duplicate tag should be OU-1111-4. Do not attempt to use the same tag and override the previous build.
19+
20+
Run the `make build-image` and `make build-dev-mcp-image` commands with the INTERACTIVE=0 and TAG env variables set.
21+
22+
If the image fails to build, show the error to the user and offer to debug

scripts/build-image.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ TAG="${TAG:-v1.0.0}"
88
REGISTRY_ORG="${REGISTRY_ORG:-openshift-observability-ui}"
99
DOCKER_FILE_NAME="${DOCKER_FILE_NAME:-Dockerfile.dev}"
1010
REPO="${REPO:-monitoring-plugin}"
11+
INTERACTIVE="${INTERACTIVE:-1}"
1112

1213
# Define ANSI color codes
1314
RED='\033[0;31m'
1415
GREEN='\033[0;32m'
1516
ENDCOLOR='\033[0m'
1617

17-
# Prompt user for TAG
18-
read -p "$(echo -e "${RED}Enter a value for TAG [${TAG}]: ${ENDCOLOR}")" USER_TAG
19-
if [ -n "$USER_TAG" ]; then
20-
TAG="$USER_TAG"
18+
if [[ $INTERACTIVE == 1 ]]; then
19+
# Prompt user for TAG
20+
read -p "$(echo -e "${RED}Enter a value for TAG [${TAG}]: ${ENDCOLOR}")" USER_TAG
21+
if [ -n "$USER_TAG" ]; then
22+
TAG="$USER_TAG"
23+
fi
2124
fi
2225

2326
if [[ -x "$(command -v podman)" && $PREFER_PODMAN == 1 ]]; then
@@ -41,10 +44,12 @@ echo_vars() {
4144
}
4245
echo_vars
4346

44-
# Prompt use it check env vars before proceeding to build
45-
read -r -p "Are the environmental variables correct [y/N] " response
46-
if [[ "${response:0:1}" =~ ^([nN])$ ]]; then
47-
exit 0
47+
if [[ $INTERACTIVE == 1 ]]; then
48+
# Prompt use it check env vars before proceeding to build
49+
read -r -p "Are the environmental variables correct [y/N] " response
50+
if [[ "${response:0:1}" =~ ^([nN])$ ]]; then
51+
exit 0
52+
fi
4853
fi
4954

5055
# Build

0 commit comments

Comments
 (0)