@@ -0,0 +1,2516 @@
+/*%0A * Copyright 2018 Armory, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22)%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.netflix.spinnaker.echo.artifacts;%0Aimport com.fasterxml.jackson.annotation.JsonProperty;%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0Aimport com.netflix.spinnaker.kork.artifacts.model.Artifact;%0Aimport lombok.Data;%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Component;%0A%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.stream.Collectors;%0A%0A@Component%0A@Slf4j%0Apublic class QuayArtifactExtractor implements WebhookArtifactExtractor %7B%0A%0A  final private ObjectMapper objectMapper;%0A%0A  @Autowired%0A  public QuayArtifactExtractor(ObjectMapper objectMapper) %7B this.objectMapper = objectMapper; %7D%0A%0A  @Override%0A  public List%3CArtifact%3E getArtifacts(String source, Map payload) %7B%0A    PushEvent pushEvent = objectMapper.convertValue(payload, PushEvent.class);%0A    String repository = pushEvent.getRepository();%0A    List%3CString%3E updatedTags = pushEvent.getUpdatedTags();%0A    if (repository == null %7C%7C updatedTags.size() == 0) %7B%0A      log.warn(%22Malformed push event from quay: %7B%7D%22, payload);%0A      return Collections.emptyList();%0A    %7D%0A%0A    return updatedTags.stream()%0A      .map(a -%3E Artifact.builder()%0A        .type(%22docker/image%22)%0A        .reference(String.format(%22%25s:%25s%22, pushEvent.getDockerUrl(), a))%0A        .name(pushEvent.getDockerUrl())%0A        .version(a)%0A        .provenance(pushEvent.getHomepage())%0A        .build()%0A      ).collect(Collectors.toList());%0A  %7D%0A%0A  @Override%0A  public boolean handles(String type, String source) %7B return (source != null && source.equals(%22quay%22)); %7D%0A%0A  @Data%0A  private static class PushEvent %7B%0A    private String repository;%0A    private String namespace;%0A    private String name;%0A    private String homepage;%0A    @JsonProperty(%22docker_url%22)%0A    private String dockerUrl;%0A    @JsonProperty(%22updated_tags%22)%0A    private List%3CString%3E updatedTags;%0A  %7D%0A%7D%0A

add native quay parser (#299)