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