9176a00e59d704e3068190be87a786a705817781 — Louis Solofrizzo 7 months ago bd7bd9b
cisco: Add artifact uploading with CMake rules

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>
5 files changed, 20 insertions(+), 0 deletions(-)

M .gitignore
M CMakeLists.txt
M api/CMakeLists.txt
M csc/CMakeLists.txt
A defs/artifacts/CMakeLists.txt
M .gitignore => .gitignore +1 -0
@@ 1,1 1,2 @@ build/
+ sdk/version.go

M CMakeLists.txt => CMakeLists.txt +1 -0
@@ 25,6 25,7 @@ add_subdirectory(defs/go)
  add_subdirectory(defs/ansible)
  add_subdirectory(defs/git)
+ add_subdirectory(defs/artifacts)
  
  ####
  # External contributions

M api/CMakeLists.txt => api/CMakeLists.txt +2 -0
@@ 12,3 12,5 @@ instance.go
      images.go
  )
+ 
+ upload_artifacts(cisco cisco-api x86_64)

M csc/CMakeLists.txt => csc/CMakeLists.txt +2 -0
@@ 1,3 1,5 @@ add_go_component(csc
      main.go
  )
+ 
+ upload_artifacts(cisco csc x86_64)

A defs/artifacts/CMakeLists.txt => defs/artifacts/CMakeLists.txt +14 -0
@@ 0,0 1,14 @@
+ macro(upload_artifacts PROJECT BINARY ARCH)
+     if(NOT IS_ABSOLUTE ${FILE})
+         set(FILE ${CMAKE_CURRENT_BINARY_DIR}/${FILE})
+     endif()
+ 
+     add_custom_target(artifacts-upload-${BINARY}
+         COMMAND ssh root@cdn.ne02ptzero.me mkdir -p /usr/share/artifacts/${PROJECT}/`git describe --abbrev=0`/${ARCH} &&
+             scp -oStrictHostKeyChecking=no ${BINARY} root@cdn.ne02ptzero.me:/usr/share/artifacts/${PROJECT}/`git describe --abbrev=0`/${ARCH}/${BINARY} &&
+             ssh root@cdn.ne02ptzero.me mkdir -p /usr/share/artifacts/${PROJECT}/latest/${ARCH} &&
+             scp -oStrictHostKeyChecking=no ${BINARY} root@cdn.ne02ptzero.me:/usr/share/artifacts/${PROJECT}/latest/${ARCH}/${BINARY}
+         DEPENDS ${BINARY}
+     )
+ 
+ endmacro(upload_artifacts)