From 1286b93c81980962a2e4d757302866f118f70e28 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 25 Jan 2019 15:37:44 +0530 Subject: [PATCH 1/2] examples: aws_iot: fix cmake build issue which used to pick dummy certificates For CI build now `sdkconfig.ci` file is used which builds examples assuming certificate stored on SDCard. --- .../subscribe_publish/main/CMakeLists.txt | 21 ++----------------- .../subscribe_publish/main/component.mk | 8 ------- .../aws_iot/subscribe_publish/sdkconfig.ci | 2 ++ .../aws_iot/thing_shadow/main/CMakeLists.txt | 21 ++----------------- .../aws_iot/thing_shadow/main/component.mk | 8 ------- .../aws_iot/thing_shadow/sdkconfig.ci | 2 ++ 6 files changed, 8 insertions(+), 54 deletions(-) create mode 100644 examples/protocols/aws_iot/subscribe_publish/sdkconfig.ci create mode 100644 examples/protocols/aws_iot/thing_shadow/sdkconfig.ci diff --git a/examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt b/examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt index 67b51b9f5..807ad6ea0 100644 --- a/examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt +++ b/examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt @@ -6,23 +6,6 @@ register_component() if(CONFIG_EXAMPLE_EMBEDDED_CERTS) target_add_binary_data(${COMPONENT_TARGET} "certs/aws-root-ca.pem" TEXT) - -if(NOT IDF_CI_BUILD) - add_custom_command(OUTPUT certs/certificate.pem.crt certs/private.pem.key - COMMAND echo "Dummy certificate data for continuous integration" > - certs/certificate.pem.crt - COMMAND echo "Dummy certificate data for continuous integration" > - certs/private.pem.key - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - VERBATIM) - add_custom_target(example_certificates DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt ${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key) - - add_dependencies(${COMPONENT_TARGET} example_certificates) - - target_add_binary_data(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt" TEXT) - target_add_binary_data(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key" TEXT) -else() - target_add_binary_data(${COMPONENT_TARGET} "certs/certificate.pem.crt" TEXT) - target_add_binary_data(${COMPONENT_TARGET} "certs/private.pem.key" TEXT) +target_add_binary_data(${COMPONENT_TARGET} "certs/certificate.pem.crt" TEXT) +target_add_binary_data(${COMPONENT_TARGET} "certs/private.pem.key" TEXT) endif() -endif() \ No newline at end of file diff --git a/examples/protocols/aws_iot/subscribe_publish/main/component.mk b/examples/protocols/aws_iot/subscribe_publish/main/component.mk index bc11b6393..401de47a5 100644 --- a/examples/protocols/aws_iot/subscribe_publish/main/component.mk +++ b/examples/protocols/aws_iot/subscribe_publish/main/component.mk @@ -7,16 +7,8 @@ ifdef CONFIG_EXAMPLE_EMBEDDED_CERTS # from AWS, see README for details. COMPONENT_EMBED_TXTFILES := certs/aws-root-ca.pem certs/certificate.pem.crt certs/private.pem.key -ifndef IDF_CI_BUILD # Print an error if the certificate/key files are missing $(COMPONENT_PATH)/certs/certificate.pem.crt $(COMPONENT_PATH)/certs/private.pem.key: @echo "Missing PEM file $@. This file identifies the ESP32 to AWS for the example, see README for details." exit 1 -else # IDF_CI_BUILD -# this case is for the internal Continuous Integration build which -# compiles all examples. Add some dummy certs so the example can -# compile (even though it won't work) -$(COMPONENT_PATH)/certs/certificate.pem.crt $(COMPONENT_PATH)/certs/private.pem.key: - echo "Dummy certificate data for continuous integration" > $@ -endif endif diff --git a/examples/protocols/aws_iot/subscribe_publish/sdkconfig.ci b/examples/protocols/aws_iot/subscribe_publish/sdkconfig.ci new file mode 100644 index 000000000..b59dfb870 --- /dev/null +++ b/examples/protocols/aws_iot/subscribe_publish/sdkconfig.ci @@ -0,0 +1,2 @@ +# For CI build example assuming certificates stored on sdcard +CONFIG_EXAMPLE_SDCARD_CERTS=y diff --git a/examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt b/examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt index 0fcad6405..f97a426c6 100644 --- a/examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt +++ b/examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt @@ -6,23 +6,6 @@ register_component() if(CONFIG_EXAMPLE_EMBEDDED_CERTS) target_add_binary_data(${COMPONENT_TARGET} "certs/aws-root-ca.pem" TEXT) - -if(NOT IDF_CI_BUILD) - add_custom_command(OUTPUT certs/certificate.pem.crt certs/private.pem.key - COMMAND echo "Dummy certificate data for continuous integration" > - certs/certificate.pem.crt - COMMAND echo "Dummy certificate data for continuous integration" > - certs/private.pem.key - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - VERBATIM) - add_custom_target(example_certificates DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt ${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key) - - add_dependencies(${COMPONENT_TARGET} example_certificates) - - target_add_binary_data(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/certs/certificate.pem.crt" TEXT) - target_add_binary_data(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/certs/private.pem.key" TEXT) -else() - target_add_binary_data(${COMPONENT_TARGET} "certs/certificate.pem.crt" TEXT) - target_add_binary_data(${COMPONENT_TARGET} "certs/private.pem.key" TEXT) +target_add_binary_data(${COMPONENT_TARGET} "certs/certificate.pem.crt" TEXT) +target_add_binary_data(${COMPONENT_TARGET} "certs/private.pem.key" TEXT) endif() -endif() \ No newline at end of file diff --git a/examples/protocols/aws_iot/thing_shadow/main/component.mk b/examples/protocols/aws_iot/thing_shadow/main/component.mk index bc11b6393..401de47a5 100644 --- a/examples/protocols/aws_iot/thing_shadow/main/component.mk +++ b/examples/protocols/aws_iot/thing_shadow/main/component.mk @@ -7,16 +7,8 @@ ifdef CONFIG_EXAMPLE_EMBEDDED_CERTS # from AWS, see README for details. COMPONENT_EMBED_TXTFILES := certs/aws-root-ca.pem certs/certificate.pem.crt certs/private.pem.key -ifndef IDF_CI_BUILD # Print an error if the certificate/key files are missing $(COMPONENT_PATH)/certs/certificate.pem.crt $(COMPONENT_PATH)/certs/private.pem.key: @echo "Missing PEM file $@. This file identifies the ESP32 to AWS for the example, see README for details." exit 1 -else # IDF_CI_BUILD -# this case is for the internal Continuous Integration build which -# compiles all examples. Add some dummy certs so the example can -# compile (even though it won't work) -$(COMPONENT_PATH)/certs/certificate.pem.crt $(COMPONENT_PATH)/certs/private.pem.key: - echo "Dummy certificate data for continuous integration" > $@ -endif endif diff --git a/examples/protocols/aws_iot/thing_shadow/sdkconfig.ci b/examples/protocols/aws_iot/thing_shadow/sdkconfig.ci new file mode 100644 index 000000000..b59dfb870 --- /dev/null +++ b/examples/protocols/aws_iot/thing_shadow/sdkconfig.ci @@ -0,0 +1,2 @@ +# For CI build example assuming certificates stored on sdcard +CONFIG_EXAMPLE_SDCARD_CERTS=y From 8c1c3d51a9a25709e87476935722f91050d2b868 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Mon, 28 Jan 2019 14:39:36 +0530 Subject: [PATCH 2/2] ci: remove `IDF_CI_BUILD` variable, no active users --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 425ecfe60..b195ef81a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -113,7 +113,6 @@ build_template_app: - build variables: BATCH_BUILD: "1" - IDF_CI_BUILD: "1" only: variables: - $BOT_TRIGGER_WITH_LABEL == null @@ -246,7 +245,6 @@ build_esp_idf_tests_cmake: - $LOG_PATH expire_in: 2 days variables: - IDF_CI_BUILD: "1" LOG_PATH: "$CI_PROJECT_DIR/log_examples_make" only: variables: @@ -279,7 +277,6 @@ build_esp_idf_tests_cmake: - $LOG_PATH expire_in: 2 days variables: - IDF_CI_BUILD: "1" LOG_PATH: "$CI_PROJECT_DIR/log_examples_cmake" only: variables: