ci: bajar el codigo con wget+tar; la imagen de kaniko no trae git
All checks were successful
build-image / build (push) Successful in 11m21s
All checks were successful
build-image / build (push) Successful in 11m21s
Primera pasada con secretos: el guard paso en verde y reventó el checkout con "/var/run/act/workflow/1.sh: line 4: git: not found". La imagen kaniko-project/executor:debug solo trae busybox y los binarios de kaniko: ni git ni apk para instalarlo (por eso tampoco valen las actions basadas en Node). Se baja el tarball del commit por el API de Forgejo (wget + tar de busybox) a ./src y el contexto de kaniko pasa a apuntar ahi.
This commit is contained in:
parent
6aa057f739
commit
f3ea93fc6f
1 changed files with 11 additions and 9 deletions
|
|
@ -53,20 +53,22 @@ jobs:
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Checkout a mano contra el Forgejo interno, igual que el CI de fires_flutter:
|
||||
# la imagen de kaniko no tiene Node, así que las actions basadas en JS no valen.
|
||||
- name: Checkout
|
||||
# Nada de `actions/checkout` (necesita Node) ni de `git` (la imagen de kaniko solo trae
|
||||
# busybox y los binarios de kaniko: no hay git, ni apk para instalarlo). Se baja el
|
||||
# tarball del commit por el API de Forgejo, que busybox sí sabe hacer con wget + tar.
|
||||
- name: Descargar el código
|
||||
shell: sh
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -e
|
||||
export PATH=/busybox:/kaniko:$PATH
|
||||
git config --global --add safe.directory '*'
|
||||
git init -q .
|
||||
git remote add origin "http://x-access-token:${TOKEN}@forgejo:3000/${GITHUB_REPOSITORY}.git"
|
||||
git fetch -q --depth 1 origin "${GITHUB_SHA}"
|
||||
git checkout -q FETCH_HEAD
|
||||
mkdir -p src
|
||||
wget -q -O src.tar.gz \
|
||||
"http://x-access-token:${TOKEN}@forgejo:3000/api/v1/repos/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
tar xzf src.tar.gz -C src --strip-components=1
|
||||
rm -f src.tar.gz
|
||||
test -f src/Dockerfile || { echo "No hay Dockerfile en el tarball"; ls src | head; exit 1; }
|
||||
|
||||
- name: Credenciales del registry
|
||||
shell: sh
|
||||
|
|
@ -92,7 +94,7 @@ jobs:
|
|||
# --single-snapshot y --compressed-caching=false bajan mucho el pico de RAM,
|
||||
# que es justo lo que nos importa en un host compartido.
|
||||
/kaniko/executor \
|
||||
--context "dir:///$(pwd)" \
|
||||
--context "dir://$(pwd)/src" \
|
||||
--dockerfile Dockerfile \
|
||||
--destination "${IMAGE}:${BRANCH_TAG}" \
|
||||
--destination "${IMAGE}:${SHORT_SHA}" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue