-
Notifications
You must be signed in to change notification settings - Fork 2
Build: Add convert-to-ami and Multi container image build
#4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
902625f
add convert-to-ami in Makefile
charlie3965 6b2bd32
solved missing seperator issue
charlie3965 bc3b834
Add PR review suggestions
yureutaejin fa5d890
Add condition to prevent OCI registry pushing
yureutaejin 14b1306
Migrate repository
yureutaejin cbc77be
update repo info
yureutaejin a91d293
Update phony command name
yureutaejin fb1edb6
Add dependency for `convert-to-{DISK_FORMAT}`
yureutaejin dc8f185
Fix pipeline diagram
yureutaejin f2d7b50
Disable firewalld & selinux
yureutaejin 283c1c7
Divide last stage into core and desktop to provide separated container
yureutaejin 6060834
Create bake file to build multi target
yureutaejin 756906d
Fix Makefile to use bake
yureutaejin 1bc1b31
Separate toml for different disk format
yureutaejin 75121c1
Update workflows
yureutaejin f9bcee8
fix error
yureutaejin c70e2f0
Fix README.md
yureutaejin 1b7b994
Fix minor mistakes
yureutaejin 8dd80eb
Remove `make`'s subcommand dependency
yureutaejin 143ec0a
Remove unnecessary env in step
yureutaejin b7e9273
Test convert-to-ami configured with DinD
yureutaejin 2135799
Fix `convert-to-ami` to use DinD
yureutaejin 3c9bb37
Remove Podman in prerequisite
yureutaejin dd298b1
Set SELinux to permissive by default
yureutaejin bb6d9da
Fix issue that DinD container is not removed after run
yureutaejin 19145be
Refactor few things
yureutaejin 9715928
Add step summary for image path
yureutaejin 3388235
minor fix in README
yureutaejin 13c0188
Merge branch 'main' into build/convert-to-ami
yureutaejin 2bc6267
remove unexpected newline
yureutaejin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,60 +4,68 @@ run-name: "Convert OCI Container to Disk Image - ${{ github.actor }}" | |
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| runner-group: | ||
| description: 'Type the runner group' | ||
| required: true | ||
| default: 'private-runners-yuntae' | ||
| type: string | ||
| runner-label: | ||
| description: 'Type label of runner' | ||
| required: true | ||
| default: 'ytminipc001' | ||
| type: string | ||
| oci_registry: | ||
| description: 'Type the OCI registry you want to use. e.g. `ghcr.io`, `quay.io`,`docker.io`' | ||
| description: 'Choose the OCI registry you want to use.' | ||
| required: true | ||
| options: | ||
| - ghcr.io | ||
| - quay.io | ||
| - docker.io | ||
| default: 'quay.io' | ||
| type: string | ||
| type: choice | ||
| oci_image_repo: | ||
| description: 'Type the image repository path in OCI registry you want to push (`{tenancy-namespace}/{repo-name}`)' | ||
| required: true | ||
| default: 'teamthepioneers/immutable-os-bootc' | ||
| default: 'yuntae/yob' | ||
| type: string | ||
| oci_image_tag: | ||
| description: 'Type the image tag you want to use' | ||
| required: true | ||
| default: 'latest' | ||
| type: string | ||
| target-interface: | ||
| description: 'Type the target interface you want to build (e.g. `core`, `desktop`, `all`)' | ||
| required: true | ||
| default: 'all' | ||
| type: string | ||
| default_disk: | ||
| description: 'Type disk name you want to use as rootfs (e.g `sda`, `nvme0n1`)' | ||
| required: true | ||
| default: 'sda' | ||
| type: string | ||
| disk_format: | ||
| description: 'Type the disk format you want to convert the OCI image into (e.g. `qcow2`, `iso`, `raw`)' | ||
| description: 'Choose disk format you want to convert the OCI image into' | ||
| required: true | ||
| options: | ||
| - iso | ||
| - ami | ||
| default: 'iso' | ||
| type: string | ||
| type: choice | ||
| rootfs: | ||
| description: 'Type the root filesystem you want to use (e.g. `ext4`, `xfs`, `btrfs`)' | ||
| required: false | ||
| description: 'Choose root filesystem you want to use' | ||
| required: true | ||
| options: | ||
| - btrfs | ||
| - ext4 | ||
| - xfs | ||
| default: 'btrfs' | ||
| type: choice | ||
| aws_s3_bucket: | ||
| description: '(Only for `ami` disk format) Type the AWS S3 bucket name you want to use' | ||
| required: false | ||
| default: 'none' | ||
| type: string | ||
|
|
||
| jobs: | ||
| convert-to-disk-image: | ||
| runs-on: | ||
| group: ${{ inputs.runner-group }} | ||
| labels: | ||
| - ${{ inputs.runner-label }} | ||
| - bootc-builder | ||
|
|
||
| steps: | ||
| - name: Verify prerequisites | ||
| run: | | ||
| make --version &> /dev/null || { echo "Make is not installed"; exit 1; } | ||
| [[ -d /var/lib/containers/storage ]] || \ | ||
| { echo "no /var/lib/containers/storage found. Please install Podman or Buildah and pull any container"; exit 1; } | ||
| docker --version &> /dev/null || { echo "Docker is not installed"; exit 1; } | ||
|
|
||
| - name: Checkout Repository | ||
|
|
@@ -71,54 +79,63 @@ jobs: | |
| OCI_REGISTRY_PASSWORD: ${{ secrets.OCI_REGISTRY_BOT_PASSWORD }} | ||
| OCI_REGISTRY: ${{ inputs.oci_registry }} | ||
|
|
||
| - name: Pull OCI image | ||
| - name: Configure AWS credentials | ||
| if: ${{ inputs.disk_format == 'ami' }} | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: ${{ vars.AWS_REGION }} | ||
|
|
||
| - name: Pull bootc image from OCI registry | ||
| run: | | ||
| echo "::group::Pull OCI image:" | ||
| make pull-oci-image | ||
| echo "::group::Pull bootc image from OCI registry:" | ||
| make pull-bootc | ||
| echo "::endgroup::" | ||
| env: | ||
| OCI_REGISTRY: ${{ inputs.oci_registry }} | ||
| OCI_IMAGE_REPO: ${{ inputs.oci_image_repo }} | ||
| OCI_IMAGE_TAG: ${{ inputs.oci_image_tag }} | ||
| TARGET_INTERFACE: ${{ inputs.target-interface }} | ||
|
|
||
| - name: Save image as tar | ||
| - name: Save image as tgz | ||
| run: | | ||
| make save-image-as-tar | ||
| echo "::group::Save image as tgz:" | ||
| make save-image-as-tgz | ||
| echo "::endgroup::" | ||
| env: | ||
| OCI_REGISTRY: ${{ inputs.oci_registry }} | ||
| OCI_IMAGE_REPO: ${{ inputs.oci_image_repo }} | ||
| OCI_IMAGE_TAG: ${{ inputs.oci_image_tag }} | ||
| TARGET_INTERFACE: ${{ inputs.target-interface }} | ||
|
|
||
| - name: Convert OCI image into specified disk format | ||
| run: | | ||
| echo "::group::Convert OCI image into specified disk format:" | ||
| make convert-to-disk-image | ||
| make convert-to-${DISK_FORMAT} | ||
| echo "::endgroup::" | ||
| env: | ||
| OCI_REGISTRY: ${{ inputs.oci_registry }} | ||
| OCI_IMAGE_REPO: ${{ inputs.oci_image_repo }} | ||
| OCI_IMAGE_TAG: ${{ inputs.oci_image_tag }} | ||
| TARGET_INTERFACE: ${{ inputs.target-interface }} | ||
| DISK_FORMAT: ${{ inputs.disk_format }} | ||
| DEFAULT_DISK: ${{ inputs.default_disk }} | ||
| DEFAULT_USER_NAME: ${{ secrets.DEFAULT_USER_NAME }} | ||
| DEFAULT_USER_PASSWD: ${{ secrets.DEFAULT_USER_PASSWD }} | ||
| ROOTFS: ${{ inputs.rootfs }} | ||
| AWS_S3_BUCKET: ${{ inputs.aws_s3_bucket }} | ||
| AWS_REGION: ${{ vars.AWS_REGION }} | ||
| AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
Comment on lines
112
to
+128
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GitHub Actions masked AWS Credential info |
||
|
|
||
| - name: Save disk format image | ||
| - name: Save iso format image | ||
| if: ${{ inputs.disk_format == 'iso' }} | ||
| run: | | ||
| sudo chown -R $USER:$USER ./image-builder-output | ||
| IMAGE_DIGEST=$(docker inspect ${OCI_REGISTRY}/${OCI_IMAGE_REPO}:${OCI_IMAGE_TAG} -f json | \ | ||
| jq -r .[0].Digest | cut -d ':' -f2) | ||
| [ -z "${IMAGE_DIGEST}" ] || [ "${IMAGE_DIGEST}" == "null" ] && \ | ||
| IMAGE_DIGEST=$( | ||
| docker buildx imagetools inspect ${OCI_REGISTRY}/${OCI_IMAGE_REPO}:${OCI_IMAGE_TAG} \ | ||
| --format '{{ json .Manifest}}' | \ | ||
| jq -r .digest | cut -d ':' -f2) | ||
| sudo mkdir -p /opt/bootc-os-disk-images/${IMAGE_DIGEST:0:12} | ||
| sudo mv image-builder-output /opt/bootc-os-disk-images/${IMAGE_DIGEST:0:12}/${DISK_FORMAT} | ||
| sudo mkdir -p /opt/bootc-os-disk-images/${{ github.run_number }} | ||
| sudo mv image-builder-output /opt/bootc-os-disk-images/${{ github.run_number }} | ||
| sudo rm -rf ./image-builder-output | ||
| env: | ||
| OCI_REGISTRY: ${{ inputs.oci_registry }} | ||
| OCI_IMAGE_REPO: ${{ inputs.oci_image_repo }} | ||
| OCI_IMAGE_TAG: ${{ inputs.oci_image_tag }} | ||
| DISK_FORMAT: ${{ inputs.disk_format }} | ||
| TARGET_INTERFACE: ${{ inputs.target-interface }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| **/.DS_Store | ||
| dockerfile-lint.json | ||
| *.tar | ||
| config.toml | ||
| image-builder-output/* |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevent pushing OCI registry when merge queue or status checks works