diff options
author | Monty Taylor <mordred@inaugust.com> | 2018-12-24 17:21:15 +0000 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2018-12-30 16:54:44 +0000 |
commit | 2249c43bba24cac4fcfaa69bbe569ec7988af75a (patch) | |
tree | 73b1ba69c77e24fb3d66d3cb60580182fe0acfe3 /src/zuulv3 | |
parent | 6c866e5f77b35fd573ae12e2de3d37eaa155f32c (diff) |
Update zuul quickstart
Diffstat (limited to 'src/zuulv3')
-rw-r--r-- | src/zuulv3/overview.rst | 373 |
1 files changed, 0 insertions, 373 deletions
diff --git a/src/zuulv3/overview.rst b/src/zuulv3/overview.rst index 5e6b281..c385964 100644 --- a/src/zuulv3/overview.rst +++ b/src/zuulv3/overview.rst | |||
@@ -25,13 +25,6 @@ Zuul | |||
25 | .. hidetitle:: | 25 | .. hidetitle:: |
26 | .. ansi:: images/title.ans | 26 | .. ansi:: images/title.ans |
27 | 27 | ||
28 | Monty Taylor | ||
29 | ============ | ||
30 | |||
31 | * @e_monty | ||
32 | * freenode:mordred | ||
33 | * mordred@inaugust.com | ||
34 | |||
35 | Red Hat | 28 | Red Hat |
36 | ======= | 29 | ======= |
37 | .. hidetitle:: | 30 | .. hidetitle:: |
@@ -881,372 +874,6 @@ Questions | |||
881 | 874 | ||
882 | .. ansi:: images/questions.ans | 875 | .. ansi:: images/questions.ans |
883 | 876 | ||
884 | Quick Start Prereq | ||
885 | ================== | ||
886 | |||
887 | * Install docker, docker-compose, git-review | ||
888 | |||
889 | Debian/Ubuntu: | ||
890 | |||
891 | :: | ||
892 | |||
893 | sudo apt-get install docker-compose git git-review | ||
894 | |||
895 | RHEL / CentOS / Fedora: | ||
896 | |||
897 | :: | ||
898 | |||
899 | sudo yum install docker docker-compose git git-review | ||
900 | |||
901 | OpenSuse: | ||
902 | |||
903 | :: | ||
904 | |||
905 | sudo zypper install docker docker-compose git git-review | ||
906 | |||
907 | RHEL / CentOS / Fedora / OpenSuse | ||
908 | |||
909 | :: | ||
910 | |||
911 | sudo systemctl enable docker.service | ||
912 | sudo systemctl start docker.service | ||
913 | |||
914 | Actual Quick Start | ||
915 | ================== | ||
916 | |||
917 | * git clone https://git.zuul-ci.org/zuul | ||
918 | * cd zuul | ||
919 | * cd doc/source/admin/examples | ||
920 | * docker-compose up | ||
921 | |||
922 | What's Running | ||
923 | ============== | ||
924 | |||
925 | * Zookeeper | ||
926 | * Gerrit | ||
927 | * Nodepool Launcher | ||
928 | * Zuul Scheduler | ||
929 | * Zuul Web Server | ||
930 | * Zuul Executor | ||
931 | * Apache HTTPD | ||
932 | * A container to use as a 'static' build node | ||
933 | |||
934 | How they're connected | ||
935 | ===================== | ||
936 | |||
937 | * End Users talk to Gerrit and Apache HTTPD | ||
938 | * Zuul Scheduler talks to Gerrit | ||
939 | * Nodepool Launcher, Zuul Scheduler, Zuul Web talk to Zookeeper | ||
940 | * Zuul Executor talks to Zuul Scheduler (using Gearman) | ||
941 | |||
942 | Initial provided config | ||
943 | ======================= | ||
944 | |||
945 | * docker-compose has plumbed in basic config ``etc_zuul/zuul.conf`` | ||
946 | and ``etc_zuul/main.yaml`` | ||
947 | * Gerrit Connection named "gerrit" | ||
948 | * Zuul user for that connection | ||
949 | * Git connection named "zuul-ci.org" for ``zuul-jobs`` standard library | ||
950 | |||
951 | Initial tenant | ||
952 | ============== | ||
953 | |||
954 | * Zuul is (always) multi-tenant | ||
955 | * Example config contains a tenant called ``example-tenant`` | ||
956 | * Three projects in the ``example-tenant`` tenant: | ||
957 | ``zuul-config``, ``test1``, ``test2`` | ||
958 | * Three projects are also in gerrit ready to use | ||
959 | |||
960 | zuul.conf | ||
961 | ========= | ||
962 | |||
963 | :: | ||
964 | |||
965 | [gearman] | ||
966 | server=scheduler | ||
967 | |||
968 | [gearman_server] | ||
969 | start=true | ||
970 | |||
971 | [zookeeper] | ||
972 | hosts=zk | ||
973 | |||
974 | [scheduler] | ||
975 | tenant_config=/etc/zuul/main.yaml | ||
976 | |||
977 | [web] | ||
978 | listen_address=0.0.0.0 | ||
979 | |||
980 | [executor] | ||
981 | private_key_file=/var/ssh/nodepool | ||
982 | default_username=root | ||
983 | |||
984 | zuul.conf part 2 | ||
985 | ================ | ||
986 | |||
987 | :: | ||
988 | |||
989 | [connection "gerrit"] | ||
990 | name=gerrit | ||
991 | driver=gerrit | ||
992 | server=gerrit | ||
993 | sshkey=/var/ssh/zuul | ||
994 | user=zuul | ||
995 | password=secret | ||
996 | baseurl=http://gerrit:8080 | ||
997 | auth_type=basic | ||
998 | |||
999 | [connection "zuul-ci.org"] | ||
1000 | name=zuul-ci | ||
1001 | driver=git | ||
1002 | baseurl=https://git.zuul-ci.org/ | ||
1003 | |||
1004 | main.yaml | ||
1005 | ========= | ||
1006 | |||
1007 | :: | ||
1008 | |||
1009 | - tenant: | ||
1010 | name: example-tenant | ||
1011 | source: | ||
1012 | gerrit: | ||
1013 | config-projects: | ||
1014 | - zuul-config | ||
1015 | untrusted-projects: | ||
1016 | - test1 | ||
1017 | - test2 | ||
1018 | zuul-ci.org: | ||
1019 | untrusted-projects: | ||
1020 | - zuul-jobs: | ||
1021 | include: | ||
1022 | - job | ||
1023 | |||
1024 | Gerrit Account | ||
1025 | ============== | ||
1026 | |||
1027 | * Need a user account to interact with Gerrit | ||
1028 | * Gerrit is configured in dev mode - no passwords required | ||
1029 | * Visit http://localhost:8080 | ||
1030 | * Click "Become" | ||
1031 | * Click "New Account" | ||
1032 | * Click "Register" | ||
1033 | * Enter Full Name | ||
1034 | * Click "Save Changes" | ||
1035 | * Enter username in Username field (match your local laptop user) | ||
1036 | * Copy ``~/.ssh/id_rsa.pub`` contents into SSH Key field | ||
1037 | * Click Continue | ||
1038 | |||
1039 | Config Repo | ||
1040 | =========== | ||
1041 | |||
1042 | * ``zuul-config`` is a trusted ``config-repo`` | ||
1043 | * Security and functionality of system depend on this repo | ||
1044 | * Limit its contents to minimum required | ||
1045 | |||
1046 | Config Files vs. Directories | ||
1047 | ============================ | ||
1048 | |||
1049 | * Zuul reads config from: | ||
1050 | ``.zuul.yaml``, ``zuul.yaml``, ``zuul.d`` or ``.zuul.d`` | ||
1051 | * For projects with substantial zuul config, like ``zuul-config`` | ||
1052 | ``zuul.d`` directory is likely best. | ||
1053 | * The directories are read run-parts style. | ||
1054 | * Recommended practice is splitting by type of object | ||
1055 | |||
1056 | Setting up Gating | ||
1057 | ================= | ||
1058 | |||
1059 | * We want to have changes to ``zuul-config`` be gated | ||
1060 | * We need to define pipelines: ``check`` and ``gate`` | ||
1061 | * Need to attach ``zuul-config`` to them | ||
1062 | * Start with builtin ``noop`` job (always return success) | ||
1063 | * Use regex to attach all projects to ``check`` and ``gate`` | ||
1064 | |||
1065 | Pipeline Definitions | ||
1066 | ==================== | ||
1067 | |||
1068 | * Zuul has no built-in workflow definitions, let's add ``check`` and ``gate`` | ||
1069 | |||
1070 | check pipeline | ||
1071 | ============== | ||
1072 | |||
1073 | :: | ||
1074 | |||
1075 | - pipeline: | ||
1076 | name: check | ||
1077 | description: | | ||
1078 | Newly uploaded patchsets enter this pipeline to receive an | ||
1079 | initial +/-1 Verified vote. | ||
1080 | manager: independent | ||
1081 | require: | ||
1082 | gerrit: | ||
1083 | open: True | ||
1084 | current-patchset: True | ||
1085 | trigger: | ||
1086 | gerrit: | ||
1087 | - event: patchset-created | ||
1088 | - event: change-restored | ||
1089 | success: | ||
1090 | gerrit: | ||
1091 | Verified: 1 | ||
1092 | failure: | ||
1093 | gerrit: | ||
1094 | Verified: -1 | ||
1095 | |||
1096 | gate pipeline | ||
1097 | ============= | ||
1098 | |||
1099 | :: | ||
1100 | - pipeline: | ||
1101 | name: gate | ||
1102 | description: | | ||
1103 | Changes that have been approved are enqueued in order in this | ||
1104 | pipeline, and if they pass tests, will be merged. | ||
1105 | manager: dependent | ||
1106 | post-review: True | ||
1107 | require: | ||
1108 | gerrit: | ||
1109 | open: True | ||
1110 | current-patchset: True | ||
1111 | approval: | ||
1112 | - Workflow: 1 | ||
1113 | trigger: | ||
1114 | gerrit: | ||
1115 | - event: comment-added | ||
1116 | approval: | ||
1117 | - Workflow: 1 | ||
1118 | start: | ||
1119 | gerrit: | ||
1120 | Verified: 0 | ||
1121 | success: | ||
1122 | gerrit: | ||
1123 | Verified: 2 | ||
1124 | submit: true | ||
1125 | failure: | ||
1126 | gerrit: | ||
1127 | Verified: -2 | ||
1128 | |||
1129 | Add the pipeline definitions | ||
1130 | ============================ | ||
1131 | |||
1132 | .. code-block:: bash | ||
1133 | |||
1134 | git clone http://localhost:8080/zuul-config | ||
1135 | cd zuul-config | ||
1136 | mkdir zuul.d | ||
1137 | cp ../examples/zuul-config/zuul.d/pipelines.yaml . | ||
1138 | |||
1139 | Shared Project Pipeline Definition | ||
1140 | ================================== | ||
1141 | |||
1142 | In ``examples/zuul-config/zuul.d/projects.yaml`` | ||
1143 | |||
1144 | .. code-block:: yaml | ||
1145 | |||
1146 | - project: | ||
1147 | name: ^.*$ | ||
1148 | check: | ||
1149 | jobs: [] | ||
1150 | gate: | ||
1151 | jobs: [] | ||
1152 | |||
1153 | - project: | ||
1154 | name: zuul-config | ||
1155 | check: | ||
1156 | jobs: | ||
1157 | - noop | ||
1158 | gate: | ||
1159 | jobs: | ||
1160 | - noop | ||
1161 | |||
1162 | Attach the projects to the pipelines | ||
1163 | ==================================== | ||
1164 | |||
1165 | .. code-block:: bash | ||
1166 | |||
1167 | cp ../examples/zuul-config/zuul.d/projects.yaml . | ||
1168 | |||
1169 | Commit the changes and push up for review | ||
1170 | ========================================= | ||
1171 | |||
1172 | .. code-block:: bash | ||
1173 | |||
1174 | git add zuul.d | ||
1175 | git commit | ||
1176 | git review | ||
1177 | |||
1178 | Force merging bootstrap config | ||
1179 | ============================== | ||
1180 | |||
1181 | * Zuul is running with no config, so it won't do anything | ||
1182 | * For this change (and this change only) we will bypass gating | ||
1183 | |||
1184 | Reviewing normally | ||
1185 | ================== | ||
1186 | |||
1187 | * visit http://localhost:8080/#/c/zuul-config/+/1001/ | ||
1188 | * click reply | ||
1189 | * vote +2 Code Review +1 Approved | ||
1190 | |||
1191 | Verified +2 is Missing | ||
1192 | ====================== | ||
1193 | |||
1194 | Verified +2 is what we have zuul configured to do. | ||
1195 | |||
1196 | :: | ||
1197 | success: | ||
1198 | gerrit: | ||
1199 | Verified: 2 | ||
1200 | submit: true | ||
1201 | |||
1202 | |||
1203 | Bypassing Gating | ||
1204 | ================ | ||
1205 | |||
1206 | * visit http://localhost:8080/ | ||
1207 | * click 'switch account' | ||
1208 | * click 'admin' | ||
1209 | * visit http://localhost:8080/#/c/zuul-config/+/1001/ | ||
1210 | * click reply | ||
1211 | * vote +2 Verified (normal users do not see this) | ||
1212 | * click submit (normal users do not see this) | ||
1213 | * click 'switch account' | ||
1214 | * click your username | ||
1215 | |||
1216 | Base Job | ||
1217 | ======== | ||
1218 | |||
1219 | * Every Zuul installation must define a ``base`` job | ||
1220 | * Push git repos to build node | ||
1221 | * Publish logs/artifacts | ||
1222 | * Any local specific setup | ||
1223 | * Goes in config repo - because it impacts EVERY job | ||
1224 | |||
1225 | Add Base Job to zuul-config | ||
1226 | =========================== | ||
1227 | |||
1228 | :: | ||
1229 | |||
1230 | cp ../examples/zuul-config/zuul.d/jobs.yaml . | ||
1231 | git add jobs.yaml | ||
1232 | git commit | ||
1233 | git review | ||
1234 | |||
1235 | Then go to http://localhost:8080/#/c/zuul-config/+/1002/ and approve it | ||
1236 | |||
1237 | Zuul should merge the patch | ||
1238 | =========================== | ||
1239 | |||
1240 | zuul-config is configured to use the ``noop`` job | ||
1241 | |||
1242 | Zuul tests syntax automatically | ||
1243 | =============================== | ||
1244 | |||
1245 | * Edit jobs.yaml | ||
1246 | * Change ``parent: null`` to ``parent: broken`` | ||
1247 | * git commit ; git review | ||
1248 | * Check out the review in gerrit ... there should be errors! | ||
1249 | |||
1250 | Presentty | 877 | Presentty |
1251 | ========= | 878 | ========= |
1252 | .. hidetitle:: | 879 | .. hidetitle:: |