Tengo el siguiente archivo .gitlab-ci.yml :
image: docker services: - docker:dind stages: - test - build - deploy test: stage: test before_script: - apk add --update -y python-pip - pip install docker-compose script: - echo "Testing the app" - docker-compose run app sh -c "python manage.py test && flake8" build: stage: build only: - develop - production - feature/deploy-debug-gitlab before_script: - apk add --update -y python-pip - pip install docker-compose script: - echo "Building the app" - docker-compose build deploy: stage: deploy only: - master - develop - feature/deploy - feature/deploy-debug-gitlab before_script: - apk add --update -y python-pip - pip install docker-compose script: - echo "Deploying the app" - docker-compose up -d environment: production when: manualCuando el corredor de Gitlab lo ejecuta, aparece el siguiente error:
$ apk add --update -y python-pip bash: line 82: apk: command not found ERROR: Job failed: exit status 1 ¿Cómo se supone que debo instalar apk? ¿O qué imagen aparte de la docker debo usar para ejecutar este archivo gitlab-ci.yml ?
Bueno, resulta que tenía dos corredores diferentes: uno marcado como "ejecutor de shell" (Ubuntu) y el otro marcado como "ejecutor de docker".
Este error se arrojó solo cuando el ejecutor de Ubuntu estaba enviando el trabajo, ya que Ubuntu no viene con apk.
Deshabilité el corredor de Ubuntu y resolví el problema.
La alternativa es configurar su instalación en el paso anterior a la prueba, como en este problema
image: docker:latest services: - docker:dind before_script: - apk add --update python-pip