38efb5c35fb020fa6d9a945cf6c1f0925c4e0f92
[octopus.git] / docs / opnfv-artifact-repository.rst
1 ===========================
2  OPNFV Artifact Repository
3 ===========================
4
5 Artifact Repository
6 ===================
7
8 What is Artifact Repository
9 ---------------------------
10
11 An Artifact Repository is akin to what Subversion is to source code, i.e. it is a way of versioning artifacts produced by build systems, CI, and so on. [1]
12
13 Why Artifact Repository is Needed
14 ---------------------------------
15
16 Since many developers check their source code into the GIT repository it may seem natural to just place the files you've built into the repo too. This can work okay for a single developer working on a project over the weekends but with a team working on many components that need to be tested and integrated, this won't scale.
17
18 The way git works, no revision of any file is ever lost. So if you ever check in a big file, the repository will always contain it, and a git clone will be that much slower for every clone from that point onward.
19
20 The golden rule of revision control systems applies: *check in your build scripts, not your build products*.
21
22 Unfortunately, it only takes one person to start doing this and we end up with huge repositories. Please don't do this. It will make your computers sad. Thankfully, Gerrit and code review systems are a massive disincentive to doing this.
23
24 You definitely need to avoid storing binary images in git. This is what artifact repositories are for. [2]
25
26 A “centralized image repository” is needed that can store multiple versions of various virtual machines and have something like /latest pointing to the newest uploaded image. It could be a simple nginx server that stores the output images from any jenkins job if it's successful, for instance.
27
28 OPNFV Artifact Repository
29 =========================
30
31 What is used as Artifact Repository for OPNFV
32 ---------------------------------------------
33
34 Setting up, hosting, and operating an artifact repository on OPNFV Infrastructure in Linux Foundation (LF) environment requires too much storage space. It is also not a straightforward undertaking to have robust Artifact Repository and provide 24/7 support.
35
36 OPNFV Project decided to use **Google Cloud Storage** as OPNFV Artifact Repository due to reasons summarized above. [3]
37
38 Usage of Artifact Repository in OPNFV CI
39 ----------------------------------------
40
41 Binaries/packages that are produced by OPNFV Continuous Integration (CI) are deployed/uploaded to Artifact Repository making it possible to reuse artifacts during later stages of OPNFV CI. Stored artifacts can be consumed by individual developers/organizations as well.
42
43 In OPNFV, we generally produce PDF, ISO and store them on OPNFV Artifact Repository.
44
45 OPNFV Artifact Repository Web Interface
46 ----------------------------------------
47
48 OPNFV Artifact Repository is accessible via link http://artifacts.opnfv.org/.
49
50 A proxy has been set up by LF for the community members located in countries with access restrictions to Google http://build.opnfv.org/artifacts/.
51
52 Access Rights to OPNFV Artifact Repository
53 ==========================================
54
55 As summarized in previous sections, OPNFV uses Google Cloud Storage as Artifact Repository. By default, everyone has read access to it and artifacts can be fetched/downloaded using browser, a curl-like command line HTTP client, or gsutil.
56
57 Write access to Artifact Repository is given per request basis and all the requests must go through `LF Helpdesk <opnfv-helpdesk@rt.linuxfoundation.org>`_ with an explanation regarding the purpose of write access. Once you are given write access, you can read corresponding section to store artifacts on OPNFV Artifact Repository.
58
59 How to Use OPNFV Artifact Repository
60 ====================================
61
62 There are 3 basic scenarios to use OPNFV Artifact repository.
63
64 * browsing artifacts
65 * downloading artifacts
66 * uploading artifacts
67
68 Please see corresponding sections regarding how to do these.
69
70 How to Browse Artifacts Stored on OPNFV Artifact Repository
71 -----------------------------------------------------------
72
73 You can browse stored artifacts using
74
75 * **Web Browser**: By navigating to the address `OPNFV Artifact Storage <http://artifacts.opnfv.org/>`_.
76
77 * **Command Line HTTP-client**
78     ``curl -o <output_filename> http://artifacts.opnfv.org``
79
80     Example:
81
82     ``curl -o opnfv-artifact-repo.html http://artifacts.opnfv.org``
83
84 * **Google Storage Util (gsutil)**
85     ``gsutil ls gs://artifacts.opnfv.org/<path_to_bucket>``
86
87     Example:
88
89     ``gsutil ls gs://artifacts.opnfv.org/octopus``
90
91 How to Download Artifacts from OPNFV Artifact Repository
92 --------------------------------------------------------
93
94 You can download stored artifacts using
95
96 * **Web Browser**: By navigating to the address `OPNFV Artifact Storage <http://artifacts.opnfv.org/>`_ and clicking the link of the artifact you want to download.
97
98 * **Command Line HTTP-client**
99     ``curl -o <output_filename> http://artifacts.opnfv.org/<path/to/artifact>``
100
101     Example:
102
103     ``curl -o main.pdf http://artifacts.opnfv.org/octopus/docs/release/main.pdf``
104
105 * **Google Storage Util (gsutil)**
106     ``gsutil cp gs://artifacts.opnfv.org/<path/to/artifact> <output_filename>``
107
108     Example:
109
110     ``gsutil cp gs://artifacts.opnfv.org/octopus/docs/release/main.pdf main.pdf``
111
112 How to Upload Artifacts to OPNFV Artifact Repository
113 ----------------------------------------------------
114
115 As explained in previous sections, you need to get write access for OPNFV Artifact Repository in order to upload artifacts.
116
117 Apart from write access, you also need to have Google account and have the Google Cloud Storage utility, **gsutil**, installed on your computer.
118
119 Install and Configure gsutil
120 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121
122 Please follow steps listed below.
123
124 1. Install gsutil
125
126     Please follow steps listed on `this link <https://cloud.google.com/storage/docs/gsutil_install>`_ to install gsutil to your computer.
127
128 2. Configure gsutil
129
130     Issue below command and follow the instructions. You will be asked for the project-id. The project-id is **linux-foundation-collab**.
131
132     ``gsutil config``
133
134 3. Request write access for OPNFV Artifact Repository
135
136     Send an email to `LF Helpdesk <opnfv-helpdesk@rt.linuxfoundation.org>`_ and list the reasons for the request. Do not forget to include gmail mail address.
137
138 Upload Artifacts
139 ~~~~~~~~~~~~~~~~
140
141 Once you installed and configured gsutil and got write access from LF Helpdesk, you should be able to upload artifacts to OPNFV Artifact Repository.
142
143 The command to upload artifacts is
144
145     ``gsutil cp <file_to_upload> gs://artifacts.opnfv.org/<path/to/bucket>``
146
147     Example:
148
149     ``gsutil cp README gs://artifacts.opnfv.org/octopus``
150
151 Once the upload operation is completed, you can do the listing and check to see if the artifact is where it is expected to be.
152
153     ``gsutil ls gs://artifacts.opnfv.org/<path/to/bucket>``
154
155     Example:
156
157     ``gsutil ls gs://artifacts.opnfv.org/octopus``
158
159 Getting Help
160 ============
161
162 Send an email to `LF Helpdesk <opnfv-helpdesk@rt.linuxfoundation.org>`_ or join the channel **#opnfv-octopus** on IRC.
163
164 References
165 ----------
166 1. `Why you should be using an Artifact Repository <http://blogs.collab.net/subversion/why-you-should-be-using-an-artifact-repository-part-1>`_
167 2. `Regarding VM image and Git repo <http://lists.opnfv.org/pipermail/opnfv-tech-discuss/2015-January/000591.html>`_
168 3. `Google Cloud Storage <https://cloud.google.com/storage/>`_
169
170 **Documentation tracking**
171
172 Revision: _sha1_
173
174 Build date:  _date_