diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bb4d4c12..01ca5fda 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -101,8 +101,15 @@ jobs: docker buildx build --platform linux/amd64,linux/arm64 . docker buildx build -t vpp:version --target version --load . - VPP_VERSION=$(docker run vpp:version) - TAG=v${VPP_VERSION/\~/-} + + branch=${{github.event.workflow_run.head_branch}} + if [[ $branch == *release/* ]]; then + TAG=${branch#release/} + else + VPP_VERSION=$(docker run vpp:version) + TAG=v${VPP_VERSION/\~/-} + fi + echo "TAG=${TAG}" >> $GITHUB_ENV - name: Generate files run: go generate ./... @@ -127,9 +134,16 @@ jobs: if: steps.docker_login.outcome == 'success' run: | docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/${{github.repository}}/vpp:${TAG} . --target vpp --push - docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/${{github.repository}}/vpp-dbg:${TAG} . --target vpp-dbg --push echo docker_tag=${TAG} >> $GITHUB_OUTPUT + - name: Push tag ${TAG} + id: tag_commit + if: ${{ steps.docker_push.outcome == 'success' && !contains(github.event.workflow_run.head_branch, 'release/') }} + run: | + git status + git tag ${TAG} ${{github.sha}} + git push origin ${TAG} -f + delete_github_runner: name: Delete actions runner if: ${{ always() }} @@ -179,6 +193,20 @@ jobs: ssh_id=$(metal ssh-key get -o json | jq -r '.[] | select(.label==env.ssh_label) | .id') metal ssh-key delete -i $ssh_id -f + check-gomod-deps: + needs: [build] + if: ${{ contains(github.event.workflow_run.head_branch, 'release/') }} + uses: networkservicemesh/.github/.github/workflows/check-gomod-deps.yaml@main + with: + tag: ${{ needs.build.outputs.docker_tag }} + + create-release: + needs: check-gomod-deps + if: ${{ contains(github.event.workflow_run.head_branch, 'release/') }} + uses: networkservicemesh/.github/.github/workflows/release.yaml@main + secrets: + token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} + update_dependent_repositories: name: update_dependent_repositories needs: build diff --git a/.github/workflows/update-dependent-repositories.yaml b/.github/workflows/update-dependent-repositories.yaml index 5acd02d6..fc2f3ca2 100644 --- a/.github/workflows/update-dependent-repositories.yaml +++ b/.github/workflows/update-dependent-repositories.yaml @@ -42,7 +42,7 @@ jobs: - name: Create commit message working-directory: ${{ github.repository }} run: | - echo "Update go.mod and go.sum to latest version from ${{ github.repository }}@main" >> /tmp/commit-message + echo "Update go.mod and go.sum to latest version from ${{ github.repository }}@${{ inputs.docker_tag }}" >> /tmp/commit-message echo "PR link: https://github.com/${{ github.repository }}/pull/${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message echo "" >> /tmp/commit-message LOG_MSG=$(git log --date=iso --pretty='format:Commit: %h%nAuthor: %an%nDate: %ad%nMessage:%n - %B%n' -1 | sed '/^$/d;$d') @@ -68,7 +68,7 @@ jobs: exit 0 fi - go get -u github.com/${{ github.repository }}@${{ github.sha }} + go get -u github.com/${{ github.repository }}@${{ inputs.docker_tag }} go mod tidy git diff - name: Find and Replace version diff --git a/README.md b/README.md index 125ff01d..1f32941a 100644 --- a/README.md +++ b/README.md @@ -3,33 +3,30 @@ This repo provides the go binding for a version of vpp. ```go -import "github.com/edwarnicke/govpp/binapi" +import "github.com/networkservicemesh/govpp/binapi" ``` -This repo also provides minimal docker containers for running vpp: +This repo also provides minimal docker container for running vpp: -- [vpp](https://github.com/users/edwarnicke/packages/container/package/govpp%2Fvpp) -- [vpp-dbg](https://github.com/users/edwarnicke/packages/container/package/govpp%2Fvpp) - debug image +- [vpp](https://github.com/networkservicemesh/govpp/pkgs/container/govpp%2Fvpp) ## How to match the version of vpp you want to the go bindings. -Whenever a combination of [VPP_VERSION](https://github.com/edwarnicke/govpp/blob/e0e3b4843cf510bccc6e6a6eac43729a5e5fa42f/Dockerfile#L1) -and [cherrypicks/patches](https://github.com/edwarnicke/govpp/blob/e0e3b4843cf510bccc6e6a6eac43729a5e5fa42f/patch/patch.sh) is used to build vpp/vpp-dbg docker containers, -they will be tagged in the docker repo. The corresponding tag will be laid on the main branch containing the corresponding -binapi. +Whenever a combination of [VPP_VERSION](https://github.com/networkservicemesh/govpp/blob/main/Dockerfile#L1) +and [cherrypicks/patches](https://github.com/networkservicemesh/govpp/blob/main/patch/patch.sh) is used to build govpp/vpp docker container, they will be tagged in the docker repo. The corresponding tag will be laid on the main branch containing the corresponding binapi. So simply run in the same directory as your go.mod file: ```bash -go get github.com/edwarnicke/govpp/binapi@${tag} +go get github.com/networkservicemesh/govpp/binapi@${tag} ``` -Where `${tag}` is the tag of the vpp container you are consuming. +Where `${tag}` is the tag of the govpp/vpp container you are consuming. For example: ```bash -go get github.com/edwarnicke/govpp/binapi@v21.06.0-9-16f166164 +go get github.com/networkservicemesh/govpp/binapi@v21.06.0-9-16f166164 ``` To set your go dependency for govpp to match the docker container you are using. @@ -39,9 +36,9 @@ To set your go dependency for govpp to match the docker container you are using. If you want a version of VPP, you can fork *this* repo and add it yourself. Because things are very heavily patterned and generated, its really quite easy: -1. Change default value for ARG VPP_VERSION in [Dockerfile](https://github.com/edwarnicke/govpp/blob/main/Dockerfile#L1) to the vpp tag or commit id you want to build. +1. Change default value for ARG VPP_VERSION in [Dockerfile](https://github.com/networkservicemesh/govpp/blob/main/Dockerfile#L1) to the vpp tag or commit id you want to build. 2. ```go generate ./...``` -3. Push a PR to your fork and merge it. This will push the vpp and vpp-dbg images to your repo. +3. Push a PR to your fork and merge it. This will push the govpp/vpp image to your repo. ## What to do if you need to cherrypick into VPP @@ -49,11 +46,11 @@ See [patch/patch.sh]. Simply add your cherrypicks to that file. ## What to do if you need to patch vpp: -If you want to add patches to vpp simply add them with the `.patch` suffix to the [patch/](https://github.com/edwarnicke/govpp/blob/main/patch/) directory. +If you want to add patches to vpp simply add them with the `.patch` suffix to the [patch/](https://github.com/networkservicemesh/govpp/blob/main/patch/) directory. ## What to do if you need a different version of govpp -Change the version of [govpp in the go.mod file](https://github.com/edwarnicke/govpp/blob/main/go.mod#L5) +Change the version of [govpp in the go.mod file](https://github.com/networkservicemesh/govpp/blob/main/go.mod#L5) ## How the magic works ##