Skip to content

Commit

Permalink
ci: fix tokens use
Browse files Browse the repository at this point in the history
  • Loading branch information
antmak committed Oct 22, 2024
1 parent 0937211 commit bceb7ce
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 30 deletions.
5 changes: 2 additions & 3 deletions .gitlab/ci/build-test-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
TEST_APP_CUSTOM_BRANCH="$TEST_APP_IDF_MASTER_BRANCH"
else
# Use the same idf branch name if exists
git ls-remote https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/espressif/esp-idf.git | grep "refs/heads/$CI_COMMIT_REF_NAME"
git ls-remote https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/espressif/esp-idf.git | grep "refs/heads/$CI_COMMIT_REF_NAME"
test $? -eq 0 && echo "Use IDF branch \"$CI_COMMIT_REF_NAME\"" && TEST_APP_CUSTOM_BRANCH=$CI_COMMIT_REF_NAME
fi
elif [ "${TEST_APP_IDF_DOCKER_IMAGE}" = "${TEST_APP_IDF5_2_RELEASE_DOCKER_IMAGE}" ] && [ -n "${TEST_APP_IDF5_2_BRANCH:-}" ]; then
Expand All @@ -43,7 +43,7 @@
echo "TEST_APP_CUSTOM_BRANCH=$TEST_APP_CUSTOM_BRANCH"
pushd $BUILD_TEST_APP_DIR
# Clone esp-idf
git clone --shallow-submodules --recursive --single-branch --branch $TEST_APP_CUSTOM_BRANCH -- https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/espressif/esp-idf.git esp-idf
git clone --shallow-submodules --recursive --single-branch --branch $TEST_APP_CUSTOM_BRANCH -- https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/espressif/esp-idf.git esp-idf
export IDF_PATH=$PWD/esp-idf
# Activate pyenv
if [ $(command -v pyenv) ]; then
Expand Down Expand Up @@ -126,7 +126,6 @@
- $BUILD_TEST_APP_DIR/SYSVIEW_FreeRTOS.txt
expire_in: 2 weeks
script:
- !reference [.add_gitlab_key, script]
- *prepare_test_app_build
- *do_build_test_app
- *finish_test_app_build
Expand Down
10 changes: 0 additions & 10 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
- job: style_check
script:
- *get_release_name
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- ./bootstrap
- mkdir _build && pushd _build/
Expand Down Expand Up @@ -133,7 +132,6 @@
- job: style_check
script:
- *get_release_name
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- *buildx_libusb
- export OSXCROSS_PKG_CONFIG_PATH=$PWD/$LIBUSB_VER/dist/lib/pkgconfig
Expand Down Expand Up @@ -161,7 +159,6 @@ build_linux:
- job: style_check
script:
- *get_release_name
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- apt-get update || true
- apt-get install systemd libudev-dev --force-yes -y # needed for hidapi build
Expand All @@ -187,7 +184,6 @@ build_linux_gcc_latest:
needs:
- job: style_check
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- ./bootstrap
- ./configure ${OPENOCD_CONFIGURE_OPTS}
Expand Down Expand Up @@ -258,7 +254,6 @@ build_linux_arm64_test:
- job: style_check
script:
- *get_release_name
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- *buildx_libusb
- export PKG_CONFIG_PATH=$PWD/$LIBUSB_VER/dist/lib/pkgconfig
Expand Down Expand Up @@ -310,7 +305,6 @@ scan-build:
- scanbuild_reference.html
when: always
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- ./bootstrap
- mkdir build-scanbuild
Expand Down Expand Up @@ -342,7 +336,6 @@ sparse:
- sparse_reference.log
when: always
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- ./bootstrap
- mkdir build-sparse && pushd build-sparse
Expand All @@ -366,7 +359,6 @@ build_linux_cmake:
variables:
OPENOCD_CMAKE_CONFIGURE_OPTS: ""
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- mkdir build && cd build
- cmake .. -G Ninja
Expand All @@ -384,7 +376,6 @@ build_linux_cmake:
variables:
OPENOCD_CMAKE_CONFIGURE_OPTS: ""
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- mkdir build && cd build
- cmake .. -DCMAKE_TOOLCHAIN_FILE=cmake/cross/linux-armhf.cmake
Expand All @@ -402,7 +393,6 @@ build_linux_cmake:
variables:
OPENOCD_CMAKE_CONFIGURE_OPTS: ""
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- mkdir build && cd build
- cmake .. -DCMAKE_TOOLCHAIN_FILE=cmake/cross/mingw32.cmake
Expand Down
1 change: 0 additions & 1 deletion .gitlab/ci/test-sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
variables:
PLATFORM_NAME: "linux-armhf-test"
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- !reference [.export_toolchain, script]
- export ASAN_OPTIONS=detect_invalid_pointer_pairs=2:print_stacktrace=1:strict_string_checks=1:halt_on_error=0:allocator_may_return_null=1
Expand Down
1 change: 0 additions & 1 deletion .gitlab/ci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
- export GCOV_PREFIX=$PWD/$TEST_RUN_DIR
- export GCOV_PREFIX_STRIP=2
script:
- !reference [.add_gitlab_key, script]
- !reference [.submodules_mirror_update, script]
- !reference [.export_toolchain, script]
- !reference [.run_tests_linux, script]
Expand Down
18 changes: 3 additions & 15 deletions .gitlab/ci/util.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
.add_gitlab_key_snippet: &add_gitlab_key_snippet |
command -v ssh-agent >/dev/null || exit 1
eval $(ssh-agent -s)
printf '%s\n' "${GITLAB_KEY}" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh && chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config || true

.add_gitlab_key:
script:
- *add_gitlab_key_snippet


.submodules_mirror_update_snippet: &submodules_mirror_update_snippet |
# Gitlab doesn't clean submodule contents
git submodule foreach "git clean -d -x -f" || true
# Use local mirror for submodules
git config submodule.tools/git2cl.url https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/idf/git2cl.git
git config submodule.jimtcl.url https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/idf/jimtcl.git
git config submodule.src/jtag/drivers/libjaylink.url https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/idf/libjaylink.git
git config submodule.tools/git2cl.url https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/idf/git2cl.git
git config submodule.jimtcl.url https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/idf/jimtcl.git
git config submodule.src/jtag/drivers/libjaylink.url https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/idf/libjaylink.git
git submodule update --init

.submodules_mirror_update:
Expand Down

0 comments on commit bceb7ce

Please sign in to comment.