Skip to content

Commit df8ef67

Browse files
authored
Merge pull request #81 from chainguard-demo/update-ca-slides
Updates to custom assembly to include save-as
2 parents d0887cb + 71cf2ff commit df8ef67

1 file changed

Lines changed: 34 additions & 9 deletions

File tree

custom-assembly/readme.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ This is meant to be a straightforward example of CA using the console.
3434
2. Select the org (if you have multiple) to use, this demo uses the cs-ttt-demo.dev Chainguard org.
3535
3. Select Organization Images tab
3636
4. Select the `custom-python-ui-demo` image
37-
38-
**Note:**If the image is CA enabled, you will see the "Customize Image" button on the top right of the screen. If CA has been enabled globally you should see this for all images.
39-
4037
5. (Optional) Prior to customizing the image try to run curl:
4138

4239
From your terminal run:
@@ -52,11 +49,19 @@ This is meant to be a straightforward example of CA using the console.
5249
The list that appears contains all of the entitled packages that can be added to the image, i.e. these are all the packages the org is entitled to.
5350
5451
7. Select package(s) to add to the image e.g. `curl`.
55-
8. Select "Preview Changes"
52+
8. Select "Continue"
53+
9. Choose if you would like you create a new image or customize the current image.
54+
55+
If you select `Customize the current image`, the curl package will be included in your "custom-python-ui-demo" image in every tag. Use this option when you know for certain that you would like `curl` to always be included in your image and there will be no need for any other variants. If you add specific versions of a package it may break certain tag builds.
56+
57+
If you select `Create a new image`, a duplicate image repo will be created, based on the original, but with the new packaged added. Use this option when users may still need to use the original image without customization, but you are seeking to provide an image that also has additional packages.
58+
59+
For this excercise, select `Customize the current image`.
60+
10. Select "Preview changes"
5661
5762
This view highlights of the changes to be made, and note the warnings that are display about CA images.
5863
59-
9. Select "Apply Changes"
64+
9. Select "Create"
6065
10. Select "Go to Builds"
6166
6267
This will take the user to the builds page, you may need to hit the "Refresh" button a few times in order to see the status of the build (it can take a bit for the builds to show up on the builds page).
@@ -67,15 +72,15 @@ This is meant to be a straightforward example of CA using the console.
6772
6873
When the build is completed (successful or failed) you can select one of the rows and display the logs.
6974
70-
If a build fails due to a transient infrastructure issue they will be retried. If a build fails due to something else, for example a package not being available for a specific architecture (e.g. arm64 or x86_64), you can say they should reach out to your CS team, or open a support ticket.
75+
If a build fails due to a transient infrastructure issue they will be retried. If a build fails due to something else, for example a package not being available for a specific architecture (e.g. arm64 or x86_64), reach out to your CS team or open a support ticket.
7176
7277
After the build has completed navigate to the "SBOM" tab of the page.
7378
7479
11. Select the "SBOM" tab
7580
7681
Show that the packages added now show up in the SBOM. If you search for `curl` you should see it along with the dependency `libcurl-openssl4` that was also installed as part of adding curl to the image.
7782
78-
12. (Optional) Run the custom image to verify curl has been installed:
83+
12. (Optional) Run the custom image to verify curl has been installed. Keep in mind that if you selected `Create a new image` that you will need to use that image name.
7984
8085
```
8186
docker run --pull=always --rm --entrypoint curl cgr.dev/cs-ttt-demo.dev/custom-python-ui-demo:latest -v https://chainguard.dev
@@ -145,7 +150,7 @@ In this example we will walk through converting a Dockerfile which is currently
145150
146151
4. Create Builder Custom YAML File
147152
148-
Now we will utilize Custom Assemble to replicate this docker build. We will use two CA images in this example, one for the buildtime dependencies and another for the final runtime image.
153+
Now we will utilize Custom Assembly to replicate this docker build. We will use two CA images in this example, one for the buildtime dependencies and another for the final runtime image.
149154
150155
The first step is to create a yaml file defining the packages we want to install on the custom images.
151156
@@ -162,7 +167,16 @@ In this example we will walk through converting a Dockerfile which is currently
162167
163168
5. Use chainctl to apply the customizations to the builder image
164169
165-
Use chainctl to apply the changes to the `custom-python-chainctl-demo-dev` custom image. Note: the --parent parameter may be changed if you are using a different Chainguard org and the --repo parameter may be changed if you are using a different CA image. Here we use the --yes flag to auto confirm the changes.
170+
Use chainctl to apply the changes to the `custom-python-chainctl-demo-dev` custom image. Here we will utilize some command switches that are documented [here](https://edu.chainguard.dev/chainguard/chainctl/chainctl-docs/chainctl_images_repos_build_apply/)
171+
172+
```
173+
--parent string The name or id of the parent location to apply build config.
174+
--repo string The name or id of the repo to apply build config.
175+
--save-as string Create a new repo with the edited configuration instead of updating the existing one.
176+
-y, --yes Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively.
177+
```
178+
179+
Note: the --parent parameter may be changed if you are using a different Chainguard org. Here we use the --yes flag to auto confirm the changes. Remember that changes to an existing image will affect every tag. This may break the functionality of other tags depending on how your organization uses tags.
166180
167181
```
168182
ORGANIZATION="cs-ttt-demo.dev"
@@ -171,6 +185,17 @@ In this example we will walk through converting a Dockerfile which is currently
171185
chainctl image repo build apply -f python-ca-builder.yaml --parent $ORGANIZATION --repo $REPO --yes
172186
```
173187
188+
Note: if you want to save this image as a different name, similar to the `Create a new image` option on the web, use the --save-as parameter in addtion to the --repo paremeter. The --repo parameter specifies the source repo you are creating the image from.
189+
190+
```
191+
ORGANIZATION="cs-ttt-demo.dev"
192+
REPO="custom-python-curl-chainctl-demo-dev"
193+
NEW_REPO="mariadb-python-chainctl-demo-dev"
194+
195+
chainctl image repo build apply -f python-ca-builder.yaml --parent $ORGANIZATION --repo $REPO --save-as $NEW_REPO --yes
196+
```
197+
198+
174199
6. Get status of the build
175200
176201
After submitting the changes, we can use chainctl to get the status of the image build:

0 commit comments

Comments
 (0)