ci: run build-push on host instead of container
Some checks failed
CI / Lint & Format (push) Successful in 22s
CI / Security Scan (push) Successful in 20s
CI / Advanced Security Tests (push) Successful in 15s
CI / Memory Leak Check (push) Successful in 19s
CI / Security Tests (push) Successful in 25s
CI / Unit Tests (push) Successful in 33s
CI / SBOM Generation (push) Successful in 19s
CI / Build & Push Image (push) Failing after 45s
Some checks failed
CI / Lint & Format (push) Successful in 22s
CI / Security Scan (push) Successful in 20s
CI / Advanced Security Tests (push) Successful in 15s
CI / Memory Leak Check (push) Successful in 19s
CI / Security Tests (push) Successful in 25s
CI / Unit Tests (push) Successful in 33s
CI / SBOM Generation (push) Successful in 19s
CI / Build & Push Image (push) Failing after 45s
This commit is contained in:
@@ -257,21 +257,29 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test, security-tests]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
container:
|
||||
image: quay.io/podman/stable:latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
dnf install -yq git >/dev/null 2>&1
|
||||
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
|
||||
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
# Use docker or podman, whichever is available
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
BUILD_CMD="docker"
|
||||
elif command -v podman >/dev/null 2>&1; then
|
||||
BUILD_CMD="podman"
|
||||
else
|
||||
echo "::error::Neither docker nor podman found"
|
||||
exit 1
|
||||
fi
|
||||
echo "Using: $BUILD_CMD"
|
||||
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
podman build -t flaskpaste:latest -t flaskpaste:sha-${SHORT_SHA} .
|
||||
podman images | grep flaskpaste
|
||||
$BUILD_CMD build -t flaskpaste:latest -t flaskpaste:sha-${SHORT_SHA} .
|
||||
$BUILD_CMD images | grep flaskpaste
|
||||
|
||||
- name: Push to Harbor
|
||||
env:
|
||||
@@ -285,13 +293,20 @@ jobs:
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Use docker or podman
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
BUILD_CMD="docker"
|
||||
else
|
||||
BUILD_CMD="podman"
|
||||
fi
|
||||
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
|
||||
podman login "${HARBOR_REGISTRY}" \
|
||||
-u "$HARBOR_USER" -p "$HARBOR_PASS" --tls-verify=false
|
||||
$BUILD_CMD login "${HARBOR_REGISTRY}" \
|
||||
-u "$HARBOR_USER" -p "$HARBOR_PASS"
|
||||
|
||||
for tag in latest sha-${SHORT_SHA}; do
|
||||
podman tag flaskpaste:latest "${HARBOR_REGISTRY}/library/flaskpaste:${tag}"
|
||||
podman push "${HARBOR_REGISTRY}/library/flaskpaste:${tag}" --tls-verify=false
|
||||
$BUILD_CMD tag flaskpaste:latest "${HARBOR_REGISTRY}/library/flaskpaste:${tag}"
|
||||
$BUILD_CMD push "${HARBOR_REGISTRY}/library/flaskpaste:${tag}"
|
||||
echo "Pushed: ${HARBOR_REGISTRY}/library/flaskpaste:${tag}"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user