I am running a docker on my VM.
Normally, whenever we do a new tag in Gitlab we want to also do a release. I have solved this by using the following .gitlab-ci.yml config:
Code: Select all
stages: # List of stages for jobs, and their order of execution
- release
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: "$CI_COMMIT_TAG"
description: "$CI_COMMIT_TAG"
I have also recently found out that esp-idf has its own docker image so I thought it would make sense to also do some optimizations.
I want to be able to execute the following command when we create a new Gitlab tag.
Code: Select all
esptool.py --chip esp32 merge_bin -o flash_image.bin @flash_args
So I have updated my .gitlab-ci.yml:
Code: Select all
stages: # List of stages for jobs, and their order of execution
- release
- build
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: "$CI_COMMIT_TAG"
description: "$CI_COMMIT_TAG"
build-esp-idf-5.1:
image: espressif/idf:release-v5.1
variables:
GIT_SUBMODULE_STRATEGY: normal
stage: build
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- cd build; esptool.py --chip esp32 merge_bin -o flash_image.bin @flash_args
Code: Select all
Running with gitlab-runner 16.6.1 (f5da3c5a)
on VM Docker runner MxeEWKAQ, system ID: s_1de69ef528ed
Preparing the "docker" executor
00:09
Using Docker executor with image espressif/idf:release-v5.1 ...
Pulling docker image espressif/idf:release-v5.1 ...
Using docker image sha256:c0408e2a8c84b96140d4003d8b427652a407577b4c159f444c27d59df447a6ad for espressif/idf:release-v5.1 with digest espressif/idf@sha256:ce81ec99a20f76fb0991a7f5e4824d40752542a5e0d2aaa3c353113890120be0 ...
Preparing environment
00:01
Running on runner-mxeewkaq-project-120-concurrent-0 via ems-gitlab...
Getting source from Git repository
00:02
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/ci_cd/esp32_application/.git/
Checking out 9e980409 as detached HEAD (ref is v2.2.0)...
Updating/initializing submodules with git depth set to 20...
Updated submodules
Executing "step_script" stage of the job script
00:09
Using docker image sha256:c0408e2a8c84b96140d4003d8b427652a407577b4c159f444c27d59df447a6ad for espressif/idf:release-v5.1 with digest espressif/idf@sha256:ce81ec99a20f76fb0991a7f5e4824d40752542a5e0d2aaa3c353113890120be0 ...
Detecting the Python interpreter
Checking "python3" ...
Python 3.8.10
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Python requirements are satisfied.
Requirement files:
- /opt/esp/idf/tools/requirements/requirements.core.txt
Python being checked: /opt/esp/python_env/idf5.1_py3.8_env/bin/python
Added the following directories to PATH:
/opt/esp/idf/components/espcoredump
/opt/esp/idf/components/partition_table
/opt/esp/idf/components/app_update
/opt/esp/tools/xtensa-esp-elf-gdb/12.1_20221002/xtensa-esp-elf-gdb/bin
/opt/esp/tools/riscv32-esp-elf-gdb/12.1_20221002/riscv32-esp-elf-gdb/bin
/opt/esp/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin
/opt/esp/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin
/opt/esp/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin
/opt/esp/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin
/opt/esp/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin
/opt/esp/tools/cmake/3.24.0/bin
/opt/esp/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin
/opt/esp/python_env/idf5.1_py3.8_env/bin
/opt/esp/idf/tools
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
$ echo before script
before script
$ cd build; esptool.py --chip esp32 merge_bin -o flash_image.bin @flash_args
/usr/bin/bash: line 151: cd: build: No such file or directory
Running after_script
00:08
Detecting the Python interpreter
Checking "python3" ...
Python 3.8.10
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Python requirements are satisfied.
Requirement files:
- /opt/esp/idf/tools/requirements/requirements.core.txt
Python being checked: /opt/esp/python_env/idf5.1_py3.8_env/bin/python
Added the following directories to PATH:
/opt/esp/idf/components/espcoredump
/opt/esp/idf/components/partition_table
/opt/esp/idf/components/app_update
/opt/esp/tools/xtensa-esp-elf-gdb/12.1_20221002/xtensa-esp-elf-gdb/bin
/opt/esp/tools/riscv32-esp-elf-gdb/12.1_20221002/riscv32-esp-elf-gdb/bin
/opt/esp/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin
/opt/esp/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin
/opt/esp/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin
/opt/esp/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin
/opt/esp/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin
/opt/esp/tools/cmake/3.24.0/bin
/opt/esp/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin
/opt/esp/python_env/idf5.1_py3.8_env/bin
/opt/esp/idf/tools
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
Running after script...
$ echo after script
after script
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
I would appreciate any help regarding setting up CI/CD pipeline for docker executor that would be capable of doing this