mirror of
https://github.com/LamGC/jenkins-agent-with-docker.git
synced 2026-02-27 02:40:44 +00:00
Compare commits
13 Commits
2a4b08137f
...
add-readme
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fcfe9c5ab | |||
| b1595aca2c | |||
| 942f66f787 | |||
| 25a2d66a00 | |||
| 7983e87c28 | |||
| ae0a6312cf | |||
| a5dc24b7af | |||
| 48199ea5a9 | |||
| 706286cacd | |||
| 0d66e641b6 | |||
| 1a891324e3 | |||
| 55d837beb0 | |||
| 467f2f6a1a |
4
.github/workflows/build-image.yml
vendored
4
.github/workflows/build-image.yml
vendored
@ -32,6 +32,6 @@ jobs:
|
||||
context: .
|
||||
push: true
|
||||
tags: lamgc/jenkins-agent-docker:latest, lamgc/jenkins-agent-docker:${{ steps.get-version.outputs.version }}
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
@ -1 +1 @@
|
||||
null
|
||||
3355.v388858a_47b_33-14
|
||||
|
||||
@ -1,12 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
LATEST_VERSION=$(curl -s https://api.github.com/repos/jenkinsci/docker-agent/releases/latest | jq -r '.tag_name')
|
||||
CURL_EXIT_CODE=$?
|
||||
if [ $CURL_EXIT_CODE -ne 0 ] || [ -z "$LATEST_VERSION" ]; then
|
||||
echo "Failed to retrieve the latest version"
|
||||
TEMP_JSON=$(mktemp)
|
||||
trap 'rm -f "$TEMP_JSON"' EXIT
|
||||
API_URL="https://api.github.com/repos/jenkinsci/docker-agent/releases/latest"
|
||||
|
||||
HTTP_CODE=$(curl -fsL -o "$TEMP_JSON" -w "%{http_code}" "$API_URL")
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Network request failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$LATEST_VERSION" != "$(cat LATEST_VERSION)" ]; then
|
||||
if [ "$HTTP_CODE" != "200" ]; then
|
||||
echo "Error: API returned HTTP $HTTP_CODE"
|
||||
if [ -s "$TEMP_JSON" ]; then
|
||||
echo "Response body:"
|
||||
cat "$TEMP_JSON"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LATEST_VERSION=$(jq -r '.tag_name // empty' "$TEMP_JSON")
|
||||
if [ -z "$LATEST_VERSION" ] || [ "$LATEST_VERSION" == "null" ]; then
|
||||
echo "Error: Failed to extract tag_name from response."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f LATEST_VERSION ]; then
|
||||
CURRENT_VERSION=$(cat LATEST_VERSION)
|
||||
else
|
||||
CURRENT_VERSION=""
|
||||
fi
|
||||
|
||||
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then
|
||||
echo "New version found: $LATEST_VERSION (Old: $CURRENT_VERSION)"
|
||||
echo "$LATEST_VERSION" > LATEST_VERSION
|
||||
fi
|
||||
else
|
||||
echo "Already at latest version: $LATEST_VERSION"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user