fix(er-1564): cni init-agent shouldn't del tunnel port before add #388
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| push: | |
| tags: | |
| - "**" | |
| branches: | |
| - main | |
| env: | |
| cache-registry: 'docker-registry-cache.docker-registry.svc:5000' | |
| jobs: | |
| build: | |
| runs-on: [self-hosted, pod] | |
| steps: | |
| - run: echo "IMAGE_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - if: ${{ github.ref == 'refs/heads/main' }} | |
| run: echo "IMAGE_TAG=latest" >> $GITHUB_ENV | |
| - run: echo "push image to everoute/release:${{ env.IMAGE_TAG }}" | |
| - uses: actions/checkout@v2 | |
| - uses: docker/setup-qemu-action@v2 | |
| - name: Login docker hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_PUSH_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PUSH_TOKEN }} | |
| - name: Login registry.smtx.io | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: registry.smtx.io | |
| username: ${{ secrets.HARBOR_PUSH_USERNAME }} | |
| password: ${{ secrets.HARBOR_PUSH_TOKEN }} | |
| - uses: docker/build-push-action@v2 | |
| with: | |
| file: build/images/release/Dockerfile | |
| tags: | | |
| everoute/release:${{ env.IMAGE_TAG }} | |
| registry.smtx.io/everoute/release:${{ env.IMAGE_TAG }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| cache-from: type=registry,ref=${{ env.cache-registry }}/everoute/cni/build | |
| cache-to: type=registry,ref=${{ env.cache-registry }}/everoute/cni/build, mod=max | |
| - name: Check if tag is a release tag | |
| run: | | |
| if [[ ${{ github.ref }} =~ ^refs\/tags\/[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then | |
| echo "NEED_RELEASE=true" >> $GITHUB_ENV | |
| else | |
| echo "NEED_RELEASE=false" >> $GITHUB_ENV | |
| fi | |
| outputs: | |
| ReleaseTag: ${{ env.IMAGE_TAG }} | |
| NeedRelease: ${{ env.NEED_RELEASE }} | |
| publish-release: | |
| needs: [build] | |
| runs-on: [self-hosted, pod] | |
| if: ${{ needs.build.outputs.NeedRelease == 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: install helm | |
| uses: azure/setup-helm@v3 | |
| with: | |
| version: v3.10.1 | |
| - name: Login docker hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_PUSH_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PUSH_TOKEN }} | |
| - name: Login registry.smtx.io | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: registry.smtx.io | |
| username: ${{ secrets.HARBOR_PUSH_USERNAME }} | |
| password: ${{ secrets.HARBOR_PUSH_TOKEN }} | |
| - name: Generate deploy yaml | |
| run: helm template deploy/chart --set image.tag=${{ needs.build.outputs.ReleaseTag }} > deploy/everoute.yaml | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: deploy/everoute.yaml | |
| name: ${{ needs.build.outputs.ReleaseTag }} | |
| generate_release_notes: true | |
| - name: helm chart package and push | |
| run: | | |
| sed -i s#latest#${{ needs.build.outputs.ReleaseTag }}#g deploy/chart/values.yaml | |
| helm package deploy/chart --app-version ${{ needs.build.outputs.ReleaseTag }} --version ${{ needs.build.outputs.ReleaseTag }} | |
| helm push everoute-${{ needs.build.outputs.ReleaseTag }}.tgz oci://registry-1.docker.io/everoute | |
| rm -f everoute-${{ needs.build.outputs.ReleaseTag }}.tgz | |
| sed -i s#everoute/release#registry.smtx.io/everoute/release#g deploy/chart/values.yaml | |
| helm package deploy/chart --app-version ${{ needs.build.outputs.ReleaseTag }} --version ${{ needs.build.outputs.ReleaseTag }} | |
| helm push everoute-${{ needs.build.outputs.ReleaseTag }}.tgz oci://registry.smtx.io/everoute |