|
| 1 | +[id="stage-1-build-and-package-a-devfile-registry_{context}"] |
| 2 | +== Stage 1: Build and Package a Devfile Registry |
| 3 | + |
| 4 | +The main goal of this stage is: |
| 5 | + |
| 6 | +. Pull in resources into the registry as part of the registry build. |
| 7 | +. Modify the devfile to update references to those offline resources as part of the registry build. |
| 8 | + |
| 9 | +As part of the offline devfile registry build, we need to do a few steps. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* Golang 1.17.x or higher |
| 14 | +* Docker 17.05 or higher / Podman 4.0.x or higher |
| 15 | +* Git |
| 16 | +* Curl |
| 17 | +* Unzip |
| 18 | + |
| 19 | +=== Create Offline Registry |
| 20 | + |
| 21 | +Download / clone the link:https://github.com/devfile/registry[devfile/registry] repository. |
| 22 | + |
| 23 | +.Procedure: `git clone` |
| 24 | + |
| 25 | +* HTTP clone |
| 26 | ++ |
| 27 | +[source,bash] |
| 28 | +---- |
| 29 | +git clone https://github.com/devfile/registry.git /path/to/registry |
| 30 | +---- |
| 31 | ++ |
| 32 | +* SSH clone |
| 33 | ++ |
| 34 | +[source,bash] |
| 35 | +---- |
| 36 | +git clone [email protected]:devfile/registry.git /path/to/registry |
| 37 | +---- |
| 38 | + |
| 39 | +.Procedure: Download zip |
| 40 | + |
| 41 | +. Download link:https://github.com/devfile/registry[devfile/registry] |
| 42 | ++ |
| 43 | +[source,bash] |
| 44 | +---- |
| 45 | +curl -L https://github.com/devfile/registry/archive/refs/heads/main.zip \ |
| 46 | + -o registry.zip |
| 47 | +---- |
| 48 | ++ |
| 49 | +. Unzip registry |
| 50 | ++ |
| 51 | +[source,bash] |
| 52 | +---- |
| 53 | +unzip registry.zip -d /path/to/registry |
| 54 | +---- |
| 55 | + |
| 56 | +.Additional resources |
| 57 | + |
| 58 | +* Creating your own registry Git repository, see xref:building-a-custom-devfile-registry.adoc[Building a custom devfile registry] |
| 59 | + |
| 60 | +=== Download Projects / Starter Projects |
| 61 | + |
| 62 | +To package projects / starter projects you will need to download them manually then place them under `/stacks/<stack>/<zip>`. |
| 63 | + |
| 64 | +.Procedure |
| 65 | + |
| 66 | +. Zip - Download zip |
| 67 | ++ |
| 68 | +[source,bash] |
| 69 | +---- |
| 70 | +curl -L <remote-url> -o <registry_root>/stacks/<stack>/<project>.zip |
| 71 | +---- |
| 72 | ++ |
| 73 | +Example |
| 74 | ++ |
| 75 | +[source,bash] |
| 76 | +---- |
| 77 | +cd /path/to/registry |
| 78 | +curl -L https://code.quarkus.io/d?e=io.quarkus%3Aquarkus-resteasy&e=io.quarkus%3Aquarkus-micrometer&e=io.quarkus%3Aquarkus-smallrye-health&e=io.quarkus%3Aquarkus-openshift&cn=devfile \ |
| 79 | + -o stacks/java-quarkus/community.zip |
| 80 | +---- |
| 81 | ++ |
| 82 | +. Git - Package cloned contents into a zip |
| 83 | ++ |
| 84 | +[source,bash] |
| 85 | +---- |
| 86 | +git clone <remote-url> <registry_root>/stacks/<stack>/<project>.zip |
| 87 | +---- |
| 88 | ++ |
| 89 | +Example |
| 90 | ++ |
| 91 | +[source,bash] |
| 92 | +---- |
| 93 | +cd /path/to/registry |
| 94 | +git clone https://github.com/odo-devfiles/nodejs-ex.git \ |
| 95 | + stacks/nodejs/nodejs-starter.zip |
| 96 | +---- |
| 97 | ++ |
| 98 | +. GitHub - Download repository as a zip archive |
| 99 | ++ |
| 100 | +[source,bash] |
| 101 | +---- |
| 102 | +curl -L https://github.com/<user|org>/<stack_repo_name>/archive/refs/heads/<main_branch>.zip \ |
| 103 | + -o <registry_root>/stacks/<stack>/<project>.zip |
| 104 | +---- |
| 105 | ++ |
| 106 | +Example |
| 107 | ++ |
| 108 | +[source,bash] |
| 109 | +---- |
| 110 | +cd /path/to/registry |
| 111 | +curl -L https://github.com/odo-devfiles/nodejs-ex/archive/refs/heads/master.zip \ |
| 112 | + -o stacks/java-quarkus/nodejs-starter.zip |
| 113 | +---- |
| 114 | + |
| 115 | +=== Modify Devfile |
| 116 | + |
| 117 | +We need to modify the Devfile to update references to those offline resources as part of the registry build. For all the items pulled into the registry, update the corresponding Devfile entries to reference the resources within the offline version in the registry. |
| 118 | + |
| 119 | +.Starter Project Before |
| 120 | +==== |
| 121 | +---- |
| 122 | +... |
| 123 | +starterProjects: |
| 124 | + - name: nodejs-starter |
| 125 | + git: |
| 126 | + remotes: |
| 127 | + origin: https://github.com/odo-devfiles/nodejs-ex.git |
| 128 | +... |
| 129 | +---- |
| 130 | +==== |
| 131 | + |
| 132 | +.Starter Project After |
| 133 | +==== |
| 134 | +---- |
| 135 | +... |
| 136 | +starterProjects: |
| 137 | + - name: nodejs-starter |
| 138 | + zip: |
| 139 | + location: nodejs-ex.zip |
| 140 | +... |
| 141 | +---- |
| 142 | +==== |
| 143 | + |
| 144 | +=== Build Registry |
| 145 | + |
| 146 | +.Procedure |
| 147 | + |
| 148 | +. Change to registry root (if not already there) |
| 149 | ++ |
| 150 | +[source,bash] |
| 151 | +---- |
| 152 | +cd /path/to/registry |
| 153 | +---- |
| 154 | ++ |
| 155 | +. Build Registry Image |
| 156 | ++ |
| 157 | +[source,bash] |
| 158 | +---- |
| 159 | +bash .ci/build.sh |
| 160 | +---- |
0 commit comments