From 744c90f9c6420517be3a6d41c5d76548ce67a150 Mon Sep 17 00:00:00 2001 From: Lea Vauchier Date: Mon, 5 Feb 2024 16:20:42 +0100 Subject: [PATCH 1/2] Update docker registry address --- .github/workflows/cicd.yaml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 8b9a5452..cc2c4cc2 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -12,9 +12,6 @@ on: - main - staging-* -env: - nexus_server: 10.128.81.69:8082 - jobs: CICD: runs-on: self-hosted @@ -86,7 +83,7 @@ jobs: docker run myria3d:${{github.ref_name}} bash # Run the new, tagged image at least once so that is it not prunned by mistake when using docker system prune # docker save myria3d:${{github.ref_name}} -o /var/data/cicd/CICD_github_assets/CICD_docker_images/myria3d_${github.ref_name}.tar # Save the docker image as myria3d_${github.ref_name}.tar - # get version number and date, to tag the image pushed to nexus + # get version number and date, to tag the image pushed to a private docker registry - name: get version number id: tag run: | @@ -103,17 +100,17 @@ jobs: # we push on nexus an image from the main branch when it has been updated (push or accepted pull request) if: ((github.ref_name == 'main') && (github.event_name == 'push')) run: | - docker tag myria3d $nexus_server/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{steps.tag.outputs.date}} - docker login $nexus_server --username svc_lidarhd --password ${{ secrets.PASSWORD_SVC_LIDARHD }} - docker push $nexus_server/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{steps.tag.outputs.date}} + docker tag myria3d ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{steps.tag.outputs.date}} + docker login ${{ secrets.DOCKER_REGISTRY }} --username svc_lidarhd --password ${{ secrets.PASSWORD_SVC_LIDARHD }} + docker push ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{steps.tag.outputs.date}} - name: push branch docker on nexus (tagged with the branch name) # we push on nexus an image from a branch when it's pushed if: ((github.event_name == 'push') && (github.ref_name != 'main')) run: | - docker tag myria3d $nexus_server/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{github.ref_name}} - docker login $nexus_server --username svc_lidarhd --password ${{ secrets.PASSWORD_SVC_LIDARHD }} - docker push $nexus_server/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{github.ref_name}} + docker tag myria3d ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{github.ref_name}} + docker login ${{ secrets.DOCKER_REGISTRY }} --username svc_lidarhd --password ${{ secrets.PASSWORD_SVC_LIDARHD }} + docker push ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{github.ref_name}} - name: Clean dangling docker images if: always() # always do it, even if something failed From 1f1f0e4e0c6ce3ac3fb7afcf270c90c70310a4e1 Mon Sep 17 00:00:00 2001 From: Lea Vauchier Date: Mon, 5 Feb 2024 16:24:27 +0100 Subject: [PATCH 2/2] Update deprecated github actions --- .github/workflows/cicd.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index cc2c4cc2..0c66fafb 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build docker image run: docker build --build-arg http_proxy=${{ secrets.PROXY_URL }} --build-arg https_proxy=${{ secrets.PROXY_URL }} -t myria3d . @@ -87,30 +87,30 @@ jobs: - name: get version number id: tag run: | - echo "::set-output name=version::$(docker run myria3d grep '__version__' package_metadata.yaml| cut -d\" -f2)" - echo "::set-output name=date::$(date '+%Y.%m.%d')" + echo "VERSION=$(docker run myria3d grep '__version__' package_metadata.yaml| cut -d\" -f2)" >> $GITHUB_ENV + echo "DATE=$(date '+%Y.%m.%d')" >> $GITHUB_ENV # show possible tags, for debugging purpose - name: Print tags run: | - echo "${{steps.tag.outputs.version}}" - echo "${{steps.tag.outputs.date}}" + echo "${{ env.VERSION }}" + echo "${{ env.DATE }}" - name: push main docker on nexus (tagged with a date) # we push on nexus an image from the main branch when it has been updated (push or accepted pull request) if: ((github.ref_name == 'main') && (github.event_name == 'push')) run: | - docker tag myria3d ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{steps.tag.outputs.date}} + docker tag myria3d ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{ env.VERSION }}-${{ env.DATE }} docker login ${{ secrets.DOCKER_REGISTRY }} --username svc_lidarhd --password ${{ secrets.PASSWORD_SVC_LIDARHD }} - docker push ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{steps.tag.outputs.date}} + docker push ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{ env.VERSION }}-${{ env.DATE }} - name: push branch docker on nexus (tagged with the branch name) # we push on nexus an image from a branch when it's pushed if: ((github.event_name == 'push') && (github.ref_name != 'main')) run: | - docker tag myria3d ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{github.ref_name}} + docker tag myria3d ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{ env.VERSION }}-${{github.ref_name}} docker login ${{ secrets.DOCKER_REGISTRY }} --username svc_lidarhd --password ${{ secrets.PASSWORD_SVC_LIDARHD }} - docker push ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{steps.tag.outputs.version}}-${{github.ref_name}} + docker push ${{ secrets.DOCKER_REGISTRY }}/lidar_hd/myria3d:${{ env.VERSION }}-${{github.ref_name}} - name: Clean dangling docker images if: always() # always do it, even if something failed