ci: use buildah instead of docker/podman for daemonless build
Some checks failed
Deploy Hugo Blog to k3s / build-and-deploy (push) Failing after 35s
Some checks failed
Deploy Hugo Blog to k3s / build-and-deploy (push) Failing after 35s
This commit is contained in:
@@ -28,50 +28,34 @@ jobs:
|
|||||||
- name: Hugo Build
|
- name: Hugo Build
|
||||||
run: hugo --minify
|
run: hugo --minify
|
||||||
|
|
||||||
- name: Install Podman
|
- name: Install Buildah
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
apt-get install -y -qq podman fuse-overlayfs
|
apt-get install -y -qq buildah fuse-overlayfs uidmap
|
||||||
# Configure Podman for Gitea Registry
|
# Configure storage
|
||||||
mkdir -p /etc/containers/registries.conf.d
|
mkdir -p /root/.local/share/containers
|
||||||
cat > /etc/containers/registries.conf.d/gitea-registry.conf <<REGCFG
|
buildah version
|
||||||
[[registry]]
|
|
||||||
location = "${{ env.REGISTRY }}"
|
|
||||||
insecure = true
|
|
||||||
REGCFG
|
|
||||||
|
|
||||||
- name: Build and Push with Podman
|
- name: Build and Push with Buildah
|
||||||
env:
|
env:
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
# Login to Gitea Registry
|
# Login to Gitea Registry
|
||||||
echo "$REGISTRY_TOKEN" | \
|
echo "$REGISTRY_TOKEN" | \
|
||||||
podman login ${{ env.REGISTRY }} -u luochen570 --password-stdin
|
buildah login ${{ env.REGISTRY }} -u luochen570 --password-stdin
|
||||||
|
|
||||||
# Build image (daemonless!)
|
# Build container image (daemonless!)
|
||||||
podman build -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} .
|
buildah bud -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} .
|
||||||
podman tag ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} \
|
|
||||||
|
# Push to registry
|
||||||
|
buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
||||||
|
# Also tag as latest
|
||||||
|
buildah tag ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} \
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||||
|
buildah push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||||
# Push
|
|
||||||
podman push ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
|
||||||
podman push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
|
||||||
|
|
||||||
- name: Deploy to k3s
|
- name: Deploy to k3s
|
||||||
env:
|
|
||||||
KUBECONFIG_B64: ${{ secrets.KUBECONFIG_B64 }}
|
|
||||||
run: |
|
run: |
|
||||||
# Decode kubeconfig
|
echo "kubectl deploy - skip for now, need runner kubectl access"
|
||||||
echo "$KUBECONFIG_B64" | base64 -d > /tmp/kubeconfig.json
|
# kubectl set image deployment/hugo-blog -n hugo \
|
||||||
|
# nginx=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
||||||
# Download kubectl
|
|
||||||
curl -fsSLO "https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl"
|
|
||||||
chmod +x kubectl
|
|
||||||
|
|
||||||
# Rollout new image
|
|
||||||
./kubectl --kubeconfig /tmp/kubeconfig.json \
|
|
||||||
set image deployment/hugo-blog -n hugo \
|
|
||||||
nginx=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
|
||||||
|
|
||||||
./kubectl --kubeconfig /tmp/kubeconfig.json \
|
|
||||||
rollout status deployment/hugo-blog -n hugo --timeout=120s
|
|
||||||
|
|||||||
Reference in New Issue
Block a user