Skip to content

Commit 0b1a15f

Browse files
Update containerization apple main (#4)
Signed-off-by: Kathryn Baldauf <[email protected]>
1 parent f6be1ba commit 0b1a15f

34 files changed

+4887
-334
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and publish containerization test images
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
publish:
7+
type: boolean
8+
description: "Publish the built image"
9+
default: false
10+
version:
11+
type: string
12+
description: "Version of the image to create"
13+
default: "test"
14+
image:
15+
type: choice
16+
description: Test image to build
17+
options:
18+
- dockermanifestimage
19+
- emptyimage
20+
default: 'dockermanifestimage'
21+
useBuildx:
22+
type: boolean
23+
description: "Use docker buildx to build the image"
24+
default: false
25+
26+
jobs:
27+
image:
28+
name: Build test images
29+
timeout-minutes: 30
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
33+
packages: write
34+
steps:
35+
- name: Check inputs
36+
run: |
37+
if [ ${{ inputs.image }} == 'dockermanifestimage' ] && [ ${{ inputs.useBuildx }} == true ]; then
38+
echo "dockermanifestimage cannot be built with buildx"
39+
exit 1
40+
fi
41+
42+
if [ ${{ inputs.image }} == 'emptyimage' ] && [ ${{ inputs.useBuildx}} != true ]; then
43+
echo "emptyimage should be built with buildx"
44+
exit 1
45+
fi
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
- name: Login to GitHub Container Registry
49+
uses: docker/login-action@v3
50+
with:
51+
registry: ghcr.io
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
- name: Set up Docker Buildx
55+
if: ${{ inputs.useBuildx }}
56+
uses: docker/setup-buildx-action@v3
57+
- name: Build dockerfile and push image
58+
uses: docker/build-push-action@v6
59+
with:
60+
push: ${{ inputs.publish }}
61+
context: Tests/TestImages/${{ inputs.image }}
62+
tags: ghcr.io/apple/containerization/${{ inputs.image }}:${{ inputs.version }}

.github/workflows/containerization-build-template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ jobs:
6969
- name: Push vminitd image
7070
if: ${{ inputs.release }}
7171
run: |
72-
bin/cctl images tag vminit:latest ghcr.io/apple-uat/containerization/vminit:${{ inputs.version }}
73-
bin/cctl images push ghcr.io/apple-uat/containerization/vminit:${{ inputs.version }}
72+
bin/cctl images tag vminit:latest ghcr.io/apple/containerization/vminit:${{ inputs.version }}
73+
bin/cctl images push ghcr.io/apple/containerization/vminit:${{ inputs.version }}
7474
env:
7575
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7676
REGISTRY_USERNAME: ${{ github.actor }}

.github/workflows/docs-release.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
1+
# Manual workflow for releasing docs ad-hoc. Workflow can only be run for main or release branches.
2+
# Workflow does NOT publish a release of containerization.
13
name: Deploy application website
24
on:
3-
push:
4-
tags:
5-
- "[0-9]+.[0-9]+.[0-9]+"
5+
workflow_dispatch:
6+
67
permissions:
78
contents: read
89
packages: write
910
pages: write
1011

1112
jobs:
13+
checkBranch:
14+
runs-on: ubuntu-latest
15+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'ref/heads/release')
16+
steps:
17+
- name: Branch validation
18+
run: echo "Branch ${{ github.ref_name }} is allowed"
19+
1220
buildSite:
1321
name: Build application website
22+
needs: checkBranch
1423
uses: ./.github/workflows/containerization-build-template.yml
1524
secrets: inherit
1625

17-
deploy:
26+
deployDocs:
1827
runs-on: ubuntu-latest
19-
needs: buildSite
28+
needs: [checkBranch, buildSite]
2029

2130
environment:
2231
name: github-pages

.github/workflows/release.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,53 @@ on:
55
tags:
66
- "[0-9]+.[0-9]+.[0-9]+"
77

8+
permissions:
9+
contents: read
10+
packages: write
11+
pages: write
12+
813
jobs:
914
containerization:
10-
permissions:
11-
contents: read
12-
packages: write
1315
uses: ./.github/workflows/containerization-build-template.yml
1416
with:
1517
release: true
16-
version: ${{ github.ref_name }}
18+
version: ${{ github.ref_name }}
1719
secrets: inherit
20+
deployDocs:
21+
runs-on: ubuntu-latest
22+
needs: containerization
23+
environment:
24+
name: github-pages
25+
url: ${{ steps.deployment.outputs.page_url }}
26+
steps:
27+
- name: Deploy to GitHub Pages
28+
id: deployment
29+
uses: actions/deploy-pages@v4
30+
release:
31+
name: Publish release
32+
timeout-minutes: 30
33+
needs: containerization
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: write
37+
packages: read
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
- name: Package sources
44+
run: |
45+
mkdir -p outputs
46+
tar --exclude="./outputs" -czf outputs/sources.tar.gz .
47+
- name: Create release
48+
uses: softprops/action-gh-release@v2
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
name: ${{ github.ref_name }}-prerelease
52+
draft: true
53+
make_latest: false
54+
prerelease: true
55+
fail_on_unmatched_files: true
56+
files: |
57+
outputs/sources.tar.gz

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ test_results/
2121
*.ext4
2222
*.pkg
2323
*.swp
24+
*.tar.gz
25+
*.tar.xz
26+
vmlinux
2427

2528
# API docs for local preview only.
2629
_site/

CODE-OF-CONDUCT.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
## Code of Conduct
2+
3+
### Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our
7+
project and our community a harassment-free experience for everyone,
8+
regardless of age, body size, disability, ethnicity, sex
9+
characteristics, gender identity and expression, level of experience,
10+
education, socio-economic status, nationality, personal appearance,
11+
race, religion, or sexual identity and orientation.
12+
13+
### Our Standards
14+
15+
Examples of behavior that contributes to creating a positive environment
16+
include:
17+
18+
* Using welcoming and inclusive language
19+
* Being respectful of differing viewpoints and experiences
20+
* Gracefully accepting constructive criticism
21+
* Focusing on what is best for the community
22+
* Showing empathy towards other community members
23+
24+
Examples of unacceptable behavior by participants include:
25+
26+
* The use of sexualized language or imagery and unwelcome sexual
27+
attention or advances
28+
* Trolling, insulting/derogatory comments, and personal or political
29+
attacks
30+
* Public or private harassment
31+
* Publishing others’ private information, such as a physical or
32+
electronic address, without explicit permission
33+
* Other conduct which could reasonably be considered inappropriate in a
34+
professional setting
35+
36+
### Our Responsibilities
37+
38+
Project maintainers are responsible for clarifying the standards of
39+
acceptable behavior and are expected to take appropriate and fair
40+
corrective action in response to any instances of unacceptable behavior.
41+
42+
Project maintainers have the right and responsibility to remove, edit,
43+
or reject comments, commits, code, wiki edits, issues, and other
44+
contributions that are not aligned to this Code of Conduct, or to ban
45+
temporarily or permanently any contributor for other behaviors that they
46+
deem inappropriate, threatening, offensive, or harmful.
47+
48+
### Scope
49+
50+
This Code of Conduct applies within all project spaces, and it also
51+
applies when an individual is representing the project or its community
52+
in public spaces. Examples of representing a project or community
53+
include using an official project e-mail address, posting via an
54+
official social media account, or acting as an appointed representative
55+
at an online or offline event. Representation of a project may be
56+
further defined and clarified by project maintainers.
57+
58+
### Enforcement
59+
60+
Instances of abusive, harassing, or otherwise unacceptable behavior may
61+
be reported by contacting the open source team at
62+
[email protected]. All complaints will be reviewed and
63+
investigated and will result in a response that is deemed necessary and
64+
appropriate to the circumstances. The project team is obligated to
65+
maintain confidentiality with regard to the reporter of an incident.
66+
Further details of specific enforcement policies may be posted
67+
separately.
68+
69+
Project maintainers who do not follow or enforce the Code of Conduct in
70+
good faith may face temporary or permanent repercussions as determined
71+
by other members of the project’s leadership.
72+
73+
### Attribution
74+
75+
This Code of Conduct is adapted from the
76+
[Contributor Covenant](https://www.contributor-covenant.org), version 1.4,
77+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ LIBARCHIVE_UPSTREAM_REPO := https://github.com/libarchive/libarchive
2626
LIBARCHIVE_UPSTREAM_VERSION := v3.7.7
2727
LIBARCHIVE_LOCAL_DIR := workdir/libarchive
2828

29+
KATA_BINARY_PACKAGE := https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz
30+
2931
include Protobuf.Makefile
3032
.DEFAULT_GOAL := all
3133

@@ -55,7 +57,7 @@ containerization:
5557
init: vminitd
5658
@echo Creating init.ext4...
5759
@rm -f bin/init.rootfs.tar.gz bin/init.block
58-
@./bin/cctl rootfs create --vminitd vminitd/bin/vminitd --labels org.opencontainers.image.source=https://github.com/apple-uat/containerization --vmexec vminitd/bin/vmexec bin/init.rootfs.tar.gz vminit:latest
60+
@./bin/cctl rootfs create --vminitd vminitd/bin/vminitd --labels org.opencontainers.image.source=https://github.com/apple/containerization --vmexec vminitd/bin/vmexec bin/init.rootfs.tar.gz vminit:latest
5961

6062
.PHONY: cross-prep
6163
cross-prep:
@@ -81,10 +83,24 @@ test:
8183
@$(SWIFT) test --enable-code-coverage
8284

8385
.PHONY: integration
84-
integration:
86+
integration: kernel-bin
8587
@echo Running the integration tests...
8688
@./bin/containerization-integration --bootlog ./bin/boot.log
8789

90+
.PHONY: kernel-bin
91+
kernel-bin:
92+
@mkdir -p .local/
93+
ifeq (,$(wildcard .local/kata.tar.gz))
94+
@curl -SsL -o .local/kata.tar.gz ${KATA_BINARY_PACKAGE}
95+
endif
96+
ifeq (,$(wildcard .local/vmlinux))
97+
@tar -zxf .local/kata.tar.gz -C .local/ --strip-components=1
98+
@cp -L .local/opt/kata/share/kata-containers/vmlinux.container .local/vmlinux
99+
endif
100+
ifeq (,$(wildcard bin/vmlinux))
101+
@cp .local/vmlinux bin/vmlinux
102+
endif
103+
88104
.PHONY: fmt
89105
fmt: swift-fmt update-licenses
90106

@@ -107,7 +123,7 @@ check-licenses:
107123
@.local/bin/hawkeye check --fail-if-unknown
108124

109125
.PHONY: serve-docs
110-
serve-docs: site
126+
serve-docs:
111127
@echo 'to browse: open http://127.0.0.1:8000/documentation/'
112128
@python3 -m http.server --bind 127.0.0.1 --directory ./_site
113129

0 commit comments

Comments
 (0)