Merge pull request #3575 from snir911/stable-2.3-backports232

stable-2.3-backports
This commit is contained in:
Fabiano Fidêncio 2022-01-31 20:19:11 +01:00 committed by GitHub
commit e9aaefb135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 125 additions and 31 deletions

View File

@ -15,6 +15,7 @@ jobs:
name: WIP Check name: WIP Check
steps: steps:
- name: WIP Check - name: WIP Check
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: tim-actions/wip-check@1c2a1ca6c110026b3e2297bb2ef39e1747b5a755 uses: tim-actions/wip-check@1c2a1ca6c110026b3e2297bb2ef39e1747b5a755
with: with:
labels: '["do-not-merge", "wip", "rfc"]' labels: '["do-not-merge", "wip", "rfc"]'

View File

@ -5,6 +5,8 @@ on:
- opened - opened
- reopened - reopened
- synchronize - synchronize
- labeled
- unlabeled
env: env:
error_msg: |+ error_msg: |+
@ -18,24 +20,26 @@ jobs:
name: Commit Message Check name: Commit Message Check
steps: steps:
- name: Get PR Commits - name: Get PR Commits
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
id: 'get-pr-commits' id: 'get-pr-commits'
uses: tim-actions/get-pr-commits@v1.0.0 uses: tim-actions/get-pr-commits@v1.0.0
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: DCO Check - name: DCO Check
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: tim-actions/dco@2fd0504dc0d27b33f542867c300c60840c6dcb20 uses: tim-actions/dco@2fd0504dc0d27b33f542867c300c60840c6dcb20
with: with:
commits: ${{ steps.get-pr-commits.outputs.commits }} commits: ${{ steps.get-pr-commits.outputs.commits }}
- name: Commit Body Missing Check - name: Commit Body Missing Check
if: ${{ success() || failure() }} if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && ( success() || failure() ) }}
uses: tim-actions/commit-body-check@v1.0.2 uses: tim-actions/commit-body-check@v1.0.2
with: with:
commits: ${{ steps.get-pr-commits.outputs.commits }} commits: ${{ steps.get-pr-commits.outputs.commits }}
- name: Check Subject Line Length - name: Check Subject Line Length
if: ${{ success() || failure() }} if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && ( success() || failure() ) }}
uses: tim-actions/commit-message-checker-with-regex@v0.3.1 uses: tim-actions/commit-message-checker-with-regex@v0.3.1
with: with:
commits: ${{ steps.get-pr-commits.outputs.commits }} commits: ${{ steps.get-pr-commits.outputs.commits }}
@ -44,7 +48,7 @@ jobs:
post_error: ${{ env.error_msg }} post_error: ${{ env.error_msg }}
- name: Check Body Line Length - name: Check Body Line Length
if: ${{ success() || failure() }} if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && ( success() || failure() ) }}
uses: tim-actions/commit-message-checker-with-regex@v0.3.1 uses: tim-actions/commit-message-checker-with-regex@v0.3.1
with: with:
commits: ${{ steps.get-pr-commits.outputs.commits }} commits: ${{ steps.get-pr-commits.outputs.commits }}
@ -71,7 +75,7 @@ jobs:
post_error: ${{ env.error_msg }} post_error: ${{ env.error_msg }}
- name: Check Fixes - name: Check Fixes
if: ${{ success() || failure() }} if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && ( success() || failure() ) }}
uses: tim-actions/commit-message-checker-with-regex@v0.3.1 uses: tim-actions/commit-message-checker-with-regex@v0.3.1
with: with:
commits: ${{ steps.get-pr-commits.outputs.commits }} commits: ${{ steps.get-pr-commits.outputs.commits }}
@ -82,7 +86,7 @@ jobs:
one_pass_all_pass: 'true' one_pass_all_pass: 'true'
- name: Check Subsystem - name: Check Subsystem
if: ${{ success() || failure() }} if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') && ( success() || failure() ) }}
uses: tim-actions/commit-message-checker-with-regex@v0.3.1 uses: tim-actions/commit-message-checker-with-regex@v0.3.1
with: with:
commits: ${{ steps.get-pr-commits.outputs.commits }} commits: ${{ steps.get-pr-commits.outputs.commits }}

View File

@ -1,6 +1,15 @@
name: kata deploy build name: kata deploy build
on: [push, pull_request] on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- labeled
- unlabeled
push:
jobs: jobs:
build-asset: build-asset:
@ -19,11 +28,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install docker - name: Install docker
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
curl -fsSL https://test.docker.com -o test-docker.sh curl -fsSL https://test.docker.com -o test-docker.sh
sh test-docker.sh sh test-docker.sh
- name: Build ${{ matrix.asset }} - name: Build ${{ matrix.asset }}
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
make "${KATA_ASSET}-tarball" make "${KATA_ASSET}-tarball"
build_dir=$(readlink -f build) build_dir=$(readlink -f build)
@ -33,6 +44,7 @@ jobs:
KATA_ASSET: ${{ matrix.asset }} KATA_ASSET: ${{ matrix.asset }}
- name: store-artifact ${{ matrix.asset }} - name: store-artifact ${{ matrix.asset }}
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: kata-artifacts name: kata-artifacts
@ -45,14 +57,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: get-artifacts - name: get-artifacts
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: kata-artifacts name: kata-artifacts
path: build path: build
- name: merge-artifacts - name: merge-artifacts
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
make merge-builds make merge-builds
- name: store-artifacts - name: store-artifacts
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: kata-static-tarball name: kata-static-tarball
@ -63,6 +78,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: make kata-tarball - name: make kata-tarball
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
make kata-tarball make kata-tarball
sudo make install-tarball sudo make install-tarball

View File

@ -48,7 +48,18 @@ jobs:
- rootfs-initrd - rootfs-initrd
- shim-v2 - shim-v2
steps: steps:
# As Github action event `issue_comment` does not provide the right ref
# (commit/branch) to be tested, let's use this third part action to work
# this limitation around.
- name: resolve pr refs
id: refs
uses: kata-containers/resolve-pr-refs@v0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
ref: ${{ steps.refs.outputs.head_ref }}
- name: Install docker - name: Install docker
run: | run: |
curl -fsSL https://test.docker.com -o test-docker.sh curl -fsSL https://test.docker.com -o test-docker.sh
@ -75,7 +86,17 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build-asset needs: build-asset
steps: steps:
# As Github action event `issue_comment` does not provide the right ref
# (commit/branch) to be tested, let's use this third part action to work
# this limitation around.
- name: resolve pr refs
id: refs
uses: kata-containers/resolve-pr-refs@v0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
ref: ${{ steps.refs.outputs.head_ref }}
- name: get-artifacts - name: get-artifacts
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
@ -94,7 +115,17 @@ jobs:
needs: create-kata-tarball needs: create-kata-tarball
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# As Github action event `issue_comment` does not provide the right ref
# (commit/branch) to be tested, let's use this third part action to work
# this limitation around.
- name: resolve pr refs
id: refs
uses: kata-containers/resolve-pr-refs@v0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
ref: ${{ steps.refs.outputs.head_ref }}
- name: get-kata-tarball - name: get-kata-tarball
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:

View File

@ -10,12 +10,15 @@ on:
types: types:
- opened - opened
- reopened - reopened
- labeled
- unlabeled
jobs: jobs:
move-linked-issues-to-in-progress: move-linked-issues-to-in-progress:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install hub - name: Install hub
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
HUB_ARCH="amd64" HUB_ARCH="amd64"
HUB_VER=$(curl -sL "https://api.github.com/repos/github/hub/releases/latest" |\ HUB_VER=$(curl -sL "https://api.github.com/repos/github/hub/releases/latest" |\
@ -26,6 +29,7 @@ jobs:
sudo install hub /usr/local/bin sudo install hub /usr/local/bin
- name: Install hub extension script - name: Install hub extension script
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
# Clone into a temporary directory to avoid overwriting # Clone into a temporary directory to avoid overwriting
# any existing github directory. # any existing github directory.
@ -35,9 +39,11 @@ jobs:
popd &>/dev/null popd &>/dev/null
- name: Checkout code to allow hub to communicate with the project - name: Checkout code to allow hub to communicate with the project
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Move issue to "In progress" - name: Move issue to "In progress"
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
env: env:
GITHUB_TOKEN: ${{ secrets.KATA_GITHUB_ACTIONS_TOKEN }} GITHUB_TOKEN: ${{ secrets.KATA_GITHUB_ACTIONS_TOKEN }}
run: | run: |

View File

@ -20,6 +20,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install hub - name: Install hub
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
HUB_ARCH="amd64" HUB_ARCH="amd64"
HUB_VER=$(curl -sL "https://api.github.com/repos/github/hub/releases/latest" |\ HUB_VER=$(curl -sL "https://api.github.com/repos/github/hub/releases/latest" |\
@ -30,6 +31,7 @@ jobs:
sudo install hub /usr/local/bin sudo install hub /usr/local/bin
- name: Checkout code to allow hub to communicate with the project - name: Checkout code to allow hub to communicate with the project
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install porting checker script - name: Install porting checker script
@ -42,6 +44,7 @@ jobs:
popd &>/dev/null popd &>/dev/null
- name: Stop PR being merged unless it has a correct set of porting labels - name: Stop PR being merged unless it has a correct set of porting labels
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
env: env:
GITHUB_TOKEN: ${{ secrets.KATA_GITHUB_ACTIONS_TOKEN }} GITHUB_TOKEN: ${{ secrets.KATA_GITHUB_ACTIONS_TOKEN }}
run: | run: |

View File

@ -1,17 +1,29 @@
name: snap CI name: snap CI
on: ["pull_request"] on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
- labeled
- unlabeled
jobs: jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Check out - name: Check out
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Snapcraft - name: Install Snapcraft
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
uses: samuelmeuli/action-snapcraft@v1 uses: samuelmeuli/action-snapcraft@v1
- name: Build snap - name: Build snap
if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }}
run: | run: |
snapcraft -d snap --destructive-mode snapcraft -d snap --destructive-mode

View File

@ -604,11 +604,16 @@ func (c *Container) unmountHostMounts(ctx context.Context) error {
span, ctx := katatrace.Trace(ctx, c.Logger(), "unmountHostMounts", containerTracingTags, map[string]string{"container_id": c.id}) span, ctx := katatrace.Trace(ctx, c.Logger(), "unmountHostMounts", containerTracingTags, map[string]string{"container_id": c.id})
defer span.End() defer span.End()
for _, m := range c.mounts { unmountFunc := func(m Mount) (err error) {
if m.HostPath != "" {
span, _ := katatrace.Trace(ctx, c.Logger(), "unmount", containerTracingTags, map[string]string{"container_id": c.id, "host-path": m.HostPath}) span, _ := katatrace.Trace(ctx, c.Logger(), "unmount", containerTracingTags, map[string]string{"container_id": c.id, "host-path": m.HostPath})
defer func() {
if err != nil {
katatrace.AddTags(span, "error", err)
}
span.End()
}()
if err := syscall.Unmount(m.HostPath, syscall.MNT_DETACH|UmountNoFollow); err != nil { if err = syscall.Unmount(m.HostPath, syscall.MNT_DETACH|UmountNoFollow); err != nil {
c.Logger().WithFields(logrus.Fields{ c.Logger().WithFields(logrus.Fields{
"host-path": m.HostPath, "host-path": m.HostPath,
"error": err, "error": err,
@ -629,8 +634,14 @@ func (c *Container) unmountHostMounts(ctx context.Context) error {
syscall.Rmdir(m.HostPath) syscall.Rmdir(m.HostPath)
} }
} }
return nil
}
span.End() for _, m := range c.mounts {
if m.HostPath != "" {
if err := unmountFunc(m); err != nil {
return err
}
} }
} }

View File

@ -2068,10 +2068,20 @@ func (k *kataAgent) sendReq(spanCtx context.Context, request interface{}) (inter
} }
msgName := proto.MessageName(request.(proto.Message)) msgName := proto.MessageName(request.(proto.Message))
k.Lock()
if k.reqHandlers == nil {
return nil, errors.New("Client has already disconnected")
}
handler := k.reqHandlers[msgName] handler := k.reqHandlers[msgName]
if msgName == "" || handler == nil { if msgName == "" || handler == nil {
return nil, errors.New("Invalid request type") return nil, errors.New("Invalid request type")
} }
k.Unlock()
message := request.(proto.Message) message := request.(proto.Message)
ctx, cancel := k.getReqContext(spanCtx, msgName) ctx, cancel := k.getReqContext(spanCtx, msgName)
if cancel != nil { if cancel != nil {

View File

@ -54,4 +54,4 @@ sudo "${container_engine}" run \
-v "${PWD}":/share qemu-static \ -v "${PWD}":/share qemu-static \
mv "${qemu_destdir}/${qemu_tar}" /share/ mv "${qemu_destdir}/${qemu_tar}" /share/
sudo chown ${USER}:${USER} "${PWD}/${qemu_tar}" sudo chown ${USER}:$(id -gn ${USER}) "${PWD}/${qemu_tar}"