Skip to content

Commit 407d606

Browse files
committed
Add github action to mirror image
Signed-off-by: Derek McGowan <[email protected]>
1 parent 90c6ff9 commit 407d606

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/images.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "Mirror Test Image"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
upstream:
6+
description: "Upstream image to mirror"
7+
required: true
8+
default: "docker.io/library/busybox:1.32"
9+
10+
jobs:
11+
mirror:
12+
name: "Mirror Image"
13+
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write
16+
17+
defaults:
18+
run:
19+
working-directory: src/github.com/containerd/containerd
20+
21+
steps:
22+
- uses: actions/setup-go@v2
23+
with:
24+
go-version: '1.17.1'
25+
26+
- uses: actions/checkout@v2
27+
with:
28+
path: src/github.com/containerd/containerd
29+
30+
- name: Set env
31+
shell: bash
32+
run: |
33+
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
34+
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
35+
36+
- name: Install containerd dependencies
37+
env:
38+
RUNC_FLAVOR: ${{ matrix.runc }}
39+
GOFLAGS: -modcacherw
40+
run: |
41+
sudo apt-get install -y gperf
42+
sudo -E PATH=$PATH script/setup/install-seccomp
43+
44+
- name: Install containerd
45+
env:
46+
CGO_ENABLED: 1
47+
run: |
48+
make binaries GO_BUILD_FLAGS="-mod=vendor" GO_BUILDTAGS="no_btrfs"
49+
sudo -E PATH=$PATH make install
50+
51+
- name: Pull and push image
52+
shell: bash
53+
run: |
54+
sudo containerd -l debug & > /tmp/containerd.out
55+
containerd_pid=$!
56+
sleep 5
57+
58+
upstream=${{ github.event.inputs.upstream }}
59+
mirror="ghcr.io/containerd/${upstream##*/}"
60+
61+
echo "Mirroring $upstream to $mirror"
62+
63+
sudo ctr content fetch --all-platforms ${upstream}
64+
sudo ctr images ls
65+
sudo ctr --debug images push -u ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} ${mirror} ${upstream}
66+
67+
sudo kill $containerd_pid

0 commit comments

Comments
 (0)