Skip to content

Commit

Permalink
Merge pull request #28 from networkservicemesh/new-tagging
Browse files Browse the repository at this point in the history
New govpp tagging.
  • Loading branch information
denis-tingaikin authored Mar 28, 2024
2 parents 46fd41c + 0073f10 commit 8a44468
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand All @@ -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() }}
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-dependent-repositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -69,7 +69,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
Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -39,21 +36,21 @@ 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

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 ##

Expand Down

0 comments on commit 8a44468

Please sign in to comment.