cecbc3e9ee
CI/CD / build-and-push (push) Failing after 51s
Legacy builder (DOCKER_BUILDKIT=0) cannot handle OCI image indexes from registry-cache, causing fallback to Docker Hub which is unreachable. BuildKit sends proper OCI Accept headers and reads buildkitd.toml to use HTTP for both the registry-cache mirror and internal Gitea registry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
90 lines
3.9 KiB
YAML
90 lines
3.9 KiB
YAML
name: CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
REGISTRY: gitea.gitea.svc.cluster.local:3000
|
|
K8S_MANIFESTS_REPO: http://chemavx:${{ secrets.CI_TOKEN }}@gitea.gitea.svc.cluster.local:3000/chemavx/k8s-manifests.git
|
|
GIT_SSL_NO_VERIFY: "true"
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ssl-verify: false
|
|
|
|
- name: Set image tag
|
|
id: tag
|
|
run: echo "TAG=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Log in to registry
|
|
run: echo "${{ secrets.CI_TOKEN }}" | docker login gitea.gitea.svc.cluster.local:3000 -u chemavx --password-stdin
|
|
|
|
- name: Build and push bot image
|
|
run: |
|
|
TAG=${{ steps.tag.outputs.TAG }}
|
|
docker build \
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
--cache-from gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot:buildcache \
|
|
-t gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot:${TAG} \
|
|
-t gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot:buildcache \
|
|
-f Dockerfile .
|
|
docker push gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot:${TAG}
|
|
docker push gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot:buildcache
|
|
|
|
- name: Build and push API image
|
|
run: |
|
|
TAG=${{ steps.tag.outputs.TAG }}
|
|
docker build \
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
--cache-from gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-api:buildcache \
|
|
-t gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-api:${TAG} \
|
|
-t gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-api:buildcache \
|
|
-f Dockerfile.api .
|
|
docker push gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-api:${TAG}
|
|
docker push gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-api:buildcache
|
|
|
|
- name: Build and push dashboard image
|
|
run: |
|
|
TAG=${{ steps.tag.outputs.TAG }}
|
|
docker build \
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
--cache-from gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-dashboard:buildcache \
|
|
-t gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-dashboard:${TAG} \
|
|
-t gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-dashboard:buildcache \
|
|
-f dashboard/Dockerfile \
|
|
dashboard
|
|
docker push gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-dashboard:${TAG}
|
|
docker push gitea.gitea.svc.cluster.local:3000/chemavx/polymarket-bot-dashboard:buildcache
|
|
|
|
- name: Update k8s manifests
|
|
run: |
|
|
TAG=${{ steps.tag.outputs.TAG }}
|
|
|
|
git config --global user.email "ci@git.chemavx.xyz"
|
|
git config --global user.name "Gitea CI"
|
|
|
|
git clone ${{ env.K8S_MANIFESTS_REPO }} /tmp/k8s-manifests
|
|
cd /tmp/k8s-manifests
|
|
|
|
sed -i "s|image: .*polymarket-bot[^-].*|image: git.chemavx.xyz/chemavx/polymarket-bot:${TAG}|g" \
|
|
polymarket-bot/deployment-bot.yaml
|
|
sed -i "s|image: .*polymarket-bot-api.*|image: git.chemavx.xyz/chemavx/polymarket-bot-api:${TAG}|g" \
|
|
polymarket-bot/deployment-api.yaml
|
|
sed -i "s|image: .*polymarket-bot-dashboard.*|image: git.chemavx.xyz/chemavx/polymarket-bot-dashboard:${TAG}|g" \
|
|
polymarket-bot/deployment-dashboard.yaml
|
|
sed -i "s|imagePullPolicy: Never|imagePullPolicy: Always|g" \
|
|
polymarket-bot/deployment-bot.yaml \
|
|
polymarket-bot/deployment-api.yaml \
|
|
polymarket-bot/deployment-dashboard.yaml
|
|
|
|
git add polymarket-bot/deployment-bot.yaml polymarket-bot/deployment-api.yaml polymarket-bot/deployment-dashboard.yaml
|
|
git diff --cached --quiet || git commit -m "ci: update polymarket-bot images to ${TAG} [skip ci]"
|
|
git push
|