Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

improve handling of docker url dests and add UrlPathEscape template function #1059

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

laverya
Copy link
Member

@laverya laverya commented Aug 28, 2019

What I Did

Fixed #1054
Added UrlPathEscape template function
Sped up make build and make test by using GO111MODULE=off for calls to goimports

How I Did it

The template function just calls url.PathEscape, and parallels the existing UrlEncode template function (which calls url.QueryEscape)
Also handled an error where the update code could attempt to remove files from the URL's path within the filesystem. (dests are parsed as urls and checked for a scheme of "docker" - if the parsing passes and the scheme matches, the dest is not considered for removal)

How to verify it

Modify the yaml in #1054 to use UrlPathEscape:

assets:
  v1:
    - docker:
        image: alpine:latest
        source: public
        dest: docker://{{repl ConfigOption "registry_auth"}}{{repl ConfigOption "registry_address"}}/alpine:latest

config:
  v1:
  - name: registry
    title: Docker Registry
    description: Configure the Docker Registry path and authentication information. This Docker Registry will store the Bugsnag images that are required for Clustered Edition.
    items:
    - name: registry_address
      title: Docker Registry path
      help_text: The path of the Docker Registry. The Registry should be addressable with the same path from both this machine and the Kubernetes cluster.
      type: text
      required: true
    - name: registry_username
      title: Username
      type: text
      default: ""
      affix: left
    - name: registry_password
      title: Password
      type: text
      default: ""
      affix: right
    - name: registry_auth
      readonly: true
      value: '{{repl ConfigOption "registry_username" | UrlPathEscape}}:{{repl ConfigOption "registry_password" | UrlPathEscape}}@'

lifecycle:
  v1:
    - config:
        invalidates: ["render"]
    - render:
        requires: ["config"]
        root: .

and push to a GCR repository as described

Description for the Changelog

UrlPathEscape, template function to encode parts of a URL's path has been added

Picture of a Ship (not required but encouraged)

USS Forrestal (CVA-59)

@laverya laverya requested a review from emosbaugh August 28, 2019 23:15
@laverya laverya merged commit 3f0faf0 into replicatedhq:master Aug 29, 2019
@laverya laverya deleted the gcr-json-key-creds branch August 29, 2019 00:03
laverya added a commit to laverya/help-center that referenced this pull request Aug 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker asset with dest GCR repository with json_key authentication returns unauthorized
2 participants