Commit Graph

33 Commits

Author SHA1 Message Date
Monty Taylor f19e38dab5 Simplify build
We only compile for a single platform, the one inside our container.
Since we do that, we can massively simplify this build.

Change-Id: Ic7d088fd85f2cf88838cb83524aaf1c8b2e858bf
2020-07-15 12:03:05 -05:00
Zuul e0a596bf15 Merge "Handle SSL proxying and other fixes" 2020-04-08 17:11:47 +00:00
James E. Blair 26d88125ef Handle SSL proxying and other fixes
Enable mod_ssl and enable proxying to ssl-terminated endpoints.

In the case where the artifact is not found, return NULL instead
of the bogus "Artifact_not_found" url, otherwise we can end up in
a loop where we continuously append that to the url.

Strip trailing slashes from the returned proxy target.  We can't
guarantee that folks won't have a '/' at the end of the artifact
url they return to Zuul (and in fact, it's probably more correct
that they do).  But our regex in mod_rewrite guarantees that we
will add a slash to it.  One sure way to handle this is just to
strip it from the data returned from Zuul if present.

Add a .dockerignore file with both itself and the Dockerfile
added, so that docker won't rebuild extra layers (like the C++
compile layer) if we just change the Dockerfile.

Change-Id: I00dfd0b6842abedf938702a816698d1c6526974d
2020-04-08 09:50:29 -07:00
Monty Taylor dd2610207b Check to make sure artifact has a url
Before we fetch it, it needs to exist, otherwise we core-dump.

Change-Id: I086a706c70807bc547b286b0f587a27f9f19d38e
2020-04-07 13:28:04 -05:00
James E. Blair e0d10c611e Look up artifacts by metadata.type rather than name
So that we can have nice looking names like "Preview Site", find
the artifact by looking up the 'type' field in metadata.

Change-Id: Ia01e95c77f068bd8ab3a515aa023c1f79332fc67
2020-04-07 08:34:55 -07:00
Monty Taylor e55490b8b4 Use splice instead of erase/push_front
splice inserts an item into one container removing it from another
container. It seems to be what people use for this usecase in STL
LRU implementations.

Change-Id: I038aea2e3aadfce01ca30946c16fea3ce0b17b4f
2019-04-12 20:45:44 +00:00
James E. Blair 4db7857bc5 Return NULL on all errors
This is what the mod_rewrite documentation says we should return
if we are unable to map the URL.

Change-Id: Ifec0a5eb6076e36eb32bb67e0eca6ea4df3a7b13
2019-03-05 08:44:46 -08:00
James E. Blair f5121119c8 Use artifact name rather than log_url
So that we can return the preview URL as the success url, use the
artifact name to look up the forward URL.

Change-Id: I8d67e1527d8f911579779a9a036a3c7f5c79a27f
2019-03-01 12:43:13 -08:00
Monty Taylor 84a247d43e Add a cache for client objects
Rather than creating them in the loop for each, make one client
object per api url.
2019-02-11 21:16:13 +00:00
James E. Blair 7b680c18ec Use an env var for the API url 2019-02-11 08:39:01 -08:00
James E. Blair 12e8291698 Clean up comments 2019-02-11 07:47:26 -08:00
Monty Taylor 5a36c4a3eb Use boost::optional and drop std back to 14
boost::optional works on stretch and doesn't add any depends. The
c++17 support in gcc isn't complete anyway.
2019-02-11 15:27:50 +00:00
James E. Blair aa1cd8ed1c Merge branch 'master' of github.com:emonty/upgraded-octo-giggle 2019-02-11 07:25:07 -08:00
James E. Blair 07cd0862de Set cache size to 1024
And tweak the rewrite url.
2019-02-11 07:24:41 -08:00
Monty Taylor b4c96c2094 Use bool cast for testing optional<> value
We don't need the call to has_value, we can do it in the if directly.
2019-02-11 15:21:54 +00:00
Monty Taylor f463a6c794 Revert "Use uniform initializer syntax everywhere"
This reverts commit 49b41704e0.
2019-02-11 15:18:29 +00:00
Monty Taylor 49b41704e0 Use uniform initializer syntax everywhere 2019-02-11 14:53:57 +00:00
James E. Blair 9b9951dff5 Run apache
Add an apache vhost config file which uses zuul-preview as a
rewritemap.

Remove extraneous output from zuul-preview.

Add an exception handler around the http code.

Remove the mutex (as we are single threaded).

Run apache as the docker CMD.
2019-02-10 17:33:27 -08:00
Monty Taylor 8dc7bfcf16 Add mutex to gets and puts
gets and puts both mutate the underling structures. Put in a mutex
and use a guard to make sure we're not stepping on ourselves.

This almost certainly could be smarter.
2019-02-10 19:25:30 +00:00
Monty Taylor c9245f61ec Add consts to LRU and use std::optional
c++17 (which our compiler supports) has std::optional<T> that can
be used for thigns that return a value or nothing (like this) Use
that.

add in some consts and pass parameters by const reference.

use std::uint32_t instead of uint. Initialize it with the constructor
initializer list instead of in the body of the constructor, and use
uniform initialization syntax to do so.

Initialize the cache instantiation using uniform initialization.

Use a few more autos so that we don't have to type const as much.
2019-02-10 19:17:38 +00:00
James E. Blair 428a10df1f Add comments to LRU cache class 2019-02-10 10:09:08 -08:00
James E. Blair a5f2e26095 Add LRU cache 2019-02-10 10:04:44 -08:00
Monty Taylor b89f989055 Pass input string by const reference
We're not mutating the string, so it can be const. And we can pass
by reference instead of by value to avoid the copy.
2019-02-09 21:51:43 +00:00
Monty Taylor 5302413002 Get rid of -Wmissing-declaration
The extra line just looks weird.
2019-02-09 21:48:47 +00:00
James E. Blair 5105fe9e96 Read a hostname in a loop 2019-02-09 12:53:17 -08:00
Monty Taylor 00a92c15c8 Use uri builder to build the build url 2019-02-09 19:32:09 +00:00
Monty Taylor b50ca80db9 Print out some more specifics
This shows different ways to access things.
2019-02-09 19:03:20 +00:00
Monty Taylor 9791caef35 Make the method actually fetch something 2019-02-09 18:55:32 +00:00
Monty Taylor 52487147b2 Switch to cpprest and add support for it 2019-02-09 17:51:06 +00:00
James E. Blair 0242a65289 Use https 2019-02-09 08:48:06 -08:00
James E. Blair 0101e1cd39 Use restclient to load a zuul build 2019-02-09 08:46:59 -08:00
Monty Taylor ca18b09f26 Fix warnings in build
These had been turned off in oaktree because of protobuf. Turn them
back on. And then fix the unused parameter issue.
2019-02-09 16:08:41 +00:00
Monty Taylor 754c66a53c Initial commit 2019-02-09 15:55:31 +00:00