store: change main store host to api.snapcraft.io #3475

Merged
merged 4 commits into from Jun 20, 2017

Conversation

Projects
None yet
5 participants
Contributor

cjwatson commented Jun 13, 2017

As part of the enterprise store project, the store is moving over to
having a single api.snapcraft.io host which should eventually be the
front door for all queries from devices; this will make it much easier
to put something like an edge proxy in place, because only one URL will
need to be overridden.

At the moment, api.snapcraft.io only provides the non-legacy endpoints
that used to be part of Click Package Index, but it will soon be
expanded to provide others as well. This shifts snapd over to the new
host name. The older endpoints will of course be maintained for as long
as is necessary.

I've dropped the trailing api/v1/ from the URL, since we'll probably
have a v2/ at some point but that may be on an endpoint-by-endpoint
basis, so it doesn't make sense to pin all of snapd's API calls to the
same version.

The preferred way to set an alternate store API URL is now
SNAPPY_FORCE_API_URL=https://api.example.org/.
SNAPPY_USE_STAGING_STORE=1 still works as an abbreviated way to point
at staging.

Change main store host to api.snapcraft.io
As part of the enterprise store project, the store is moving over to
having a single api.snapcraft.io host which should eventually be the
front door for all queries from devices; this will make it much easier
to put something like an edge proxy in place, because only one URL will
need to be overridden.

At the moment, api.snapcraft.io only provides the non-legacy endpoints
that used to be part of Click Package Index, but it will soon be
expanded to provide others as well.  This shifts snapd over to the new
host name.  The older endpoints will of course be maintained for as long
as is necessary.

I've dropped the trailing `v1/` from the URL, since we'll probably have
a `v2/` at some point but that may be on an endpoint-by-endpoint basis,
so it doesn't make sense to pin all of snapd's API calls to the same
version.

The preferred way to set an alternate store API URL is now
`SNAPPY_FORCE_API_URL=https://api.example.org/api/`.
`SNAPPY_USE_STAGING_STORE=1` still works as an abbreviated way to point
at staging.

codecov-io commented Jun 13, 2017

Codecov Report

Merging #3475 into master will increase coverage by <.01%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3475      +/-   ##
==========================================
+ Coverage   77.15%   77.15%   +<.01%     
==========================================
  Files         373      375       +2     
  Lines       25793    25839      +46     
==========================================
+ Hits        19901    19937      +36     
- Misses       4134     4140       +6     
- Partials     1758     1762       +4
Impacted Files Coverage Δ
tests/lib/fakestore/store/store.go 64.05% <100%> (ø) ⬆️
store/store.go 79.44% <72.72%> (-0.18%) ⬇️
interfaces/sorting.go 90% <0%> (-3.34%) ⬇️
cmd/snap/cmd_aliases.go 94% <0%> (-2%) ⬇️
dirs/dirs.go 96.77% <0%> (-0.06%) ⬇️
daemon/api.go 73.18% <0%> (-0.01%) ⬇️
interfaces/builtin/udisks2.go 82.5% <0%> (ø) ⬆️
interfaces/builtin/content.go 80.73% <0%> (ø) ⬆️
interfaces/policy/basedeclaration.go 40.74% <0%> (ø) ⬆️
client/asserts.go 87.5% <0%> (ø) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 626e641...df274c3. Read the comment docs.

@pedronis pedronis changed the title from Change main store host to api.snapcraft.io to store: change main store host to api.snapcraft.io Jun 15, 2017

Drop `api/` from URL as well
It's somewhat redundant on api.snapcraft.io, although for v1 we kept it
in order to have the same URL paths as on search.apps.ubuntu.com.  For
v2 APIs we may consider using just `/v2/...` rather than `/api/v2/...`.

mvo5 approved these changes Jun 19, 2017

Thanks Colin, this looks great.

@pedronis pedronis self-requested a review Jun 20, 2017

lgtm, couple small remarks

store/store.go
// FIXME: this will become a store-url assertion
- if u := os.Getenv("SNAPPY_FORCE_CPI_URL"); u != "" {
+ // backward-compatibility: this used to be "Click Package Index"
@pedronis

pedronis Jun 20, 2017

Contributor

we probably want a TODO: or XXX: marker here, I suppose we'll drop this at some point

store/store.go
- if u := os.Getenv("SNAPPY_FORCE_CPI_URL"); u != "" {
+ // backward-compatibility: this used to be "Click Package Index"
+ if u := os.Getenv("SNAPPY_FORCE_CPI_URL"); u != "" && strings.HasSuffix(u, "api/v1/") {
+ return u[:len(u)-len("api/v1/")]
@pedronis

pedronis Jun 20, 2017

Contributor

this maybe could use strings.TrimSuffix

zyga approved these changes Jun 20, 2017

Looks good

Colin Watson added some commits Jun 20, 2017

@mvo5 mvo5 merged commit f8f841f into snapcore:master Jun 20, 2017

5 of 7 checks passed

artful-amd64 autopkgtest running
Details
zesty-amd64 autopkgtest running
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-amd64 autopkgtest finished (success)
Details
xenial-i386 autopkgtest finished (success)
Details
xenial-ppc64el autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details

@cjwatson cjwatson deleted the cjwatson:api-snapcraft-io branch Jun 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment