Resolve merge conflict
commit
363403a81b
|
|
@ -12,17 +12,27 @@
|
|||
|
||||
# Dockerfile to bootstrap build and test in openshift-ci
|
||||
|
||||
FROM FROM registry.access.redhat.com/ubi9/nodejs-18:1
|
||||
FROM registry.access.redhat.com/ubi9/nodejs-18:1
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
USER 0
|
||||
|
||||
# Install yq, kubectl, chectl cli used by olm/olm.sh script.
|
||||
RUN yum install --assumeyes -d1 python3-pip httpd-tools && \
|
||||
RUN dnf install -y -q --allowerasing --nobest nodejs-devel nodejs-libs \
|
||||
# already installed or installed as deps:
|
||||
openssl openssl-devel ca-certificates make cmake cpp gcc gcc-c++ zlib zlib-devel brotli brotli-devel python3 nodejs-packaging && \
|
||||
dnf update -y && dnf clean all && \
|
||||
npm install -g yarn@1.22 npm@9 && \
|
||||
echo -n "node version: "; node -v; \
|
||||
echo -n "npm version: "; npm -v; \
|
||||
echo -n "yarn version: "; yarn -v && \
|
||||
yum install --assumeyes -d1 python3-pip httpd-tools && \
|
||||
pip3 install --upgrade setuptools && \
|
||||
pip3 install yq && \
|
||||
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
|
||||
chmod +x ./kubectl && \
|
||||
mv ./kubectl /usr/local/bin && \
|
||||
bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next && \
|
||||
curl https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.12.4/openshift-client-linux.tar.gz | tar xvzf - -C /usr/local/bin/ oc && \
|
||||
curl https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.12.30/openshift-client-linux.tar.gz | tar xvzf - -C /usr/local/bin/ oc && \
|
||||
chmod ug+x /usr/local/bin/oc
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import javax.inject.Singleton;
|
|||
import org.eclipse.che.api.core.ApiException;
|
||||
import org.eclipse.che.api.core.BadRequestException;
|
||||
import org.eclipse.che.api.factory.server.urlfactory.DefaultFactoryUrl;
|
||||
import org.eclipse.che.api.factory.server.urlfactory.DevfileFilenamesProvider;
|
||||
import org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl;
|
||||
import org.eclipse.che.api.factory.server.urlfactory.URLFactoryBuilder;
|
||||
import org.eclipse.che.api.factory.shared.dto.FactoryMetaDto;
|
||||
|
|
@ -52,7 +51,6 @@ public class RawDevfileUrlFactoryParameterResolver implements FactoryParametersR
|
|||
|
||||
protected final URLFactoryBuilder urlFactoryBuilder;
|
||||
protected final URLFetcher urlFetcher;
|
||||
@Inject private DevfileFilenamesProvider devfileFilenamesProvider;
|
||||
|
||||
@Inject
|
||||
public RawDevfileUrlFactoryParameterResolver(
|
||||
|
|
@ -71,9 +69,7 @@ public class RawDevfileUrlFactoryParameterResolver implements FactoryParametersR
|
|||
@Override
|
||||
public boolean accept(Map<String, String> factoryParameters) {
|
||||
String url = factoryParameters.get(URL_PARAMETER_NAME);
|
||||
return !isNullOrEmpty(url)
|
||||
&& devfileFilenamesProvider.getConfiguredDevfileFilenames().stream()
|
||||
.anyMatch(url::endsWith);
|
||||
return !isNullOrEmpty(url) && (url.endsWith(".yaml") || url.endsWith(".yml"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,12 +28,10 @@ import static org.testng.Assert.fail;
|
|||
import static org.testng.AssertJUnit.assertEquals;
|
||||
import static org.testng.AssertJUnit.assertTrue;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.eclipse.che.api.core.BadRequestException;
|
||||
import org.eclipse.che.api.factory.server.urlfactory.DevfileFilenamesProvider;
|
||||
import org.eclipse.che.api.factory.server.urlfactory.RemoteFactoryUrl;
|
||||
import org.eclipse.che.api.factory.server.urlfactory.URLFactoryBuilder;
|
||||
import org.eclipse.che.api.workspace.server.devfile.DevfileParser;
|
||||
|
|
@ -67,8 +65,6 @@ public class RawDevfileUrlFactoryParameterResolverTest {
|
|||
+ " reference: ../localfile\n";
|
||||
|
||||
@Mock private URLFetcher urlFetcher;
|
||||
private final DevfileFilenamesProvider devfileFilenamesProvider =
|
||||
new DevfileFilenamesProvider("devfile.yaml, .devfile.yaml");
|
||||
|
||||
@InjectMocks private RawDevfileUrlFactoryParameterResolver rawDevfileUrlFactoryParameterResolver;
|
||||
|
||||
|
|
@ -167,16 +163,7 @@ public class RawDevfileUrlFactoryParameterResolverTest {
|
|||
}
|
||||
|
||||
@Test(dataProvider = "devfileNames")
|
||||
public void shouldAcceptRawDevfileUrl(String devfileName)
|
||||
throws NoSuchFieldException, IllegalAccessException {
|
||||
// given
|
||||
Field field =
|
||||
rawDevfileUrlFactoryParameterResolver
|
||||
.getClass()
|
||||
.getDeclaredField("devfileFilenamesProvider");
|
||||
field.setAccessible(true);
|
||||
field.set(rawDevfileUrlFactoryParameterResolver, devfileFilenamesProvider);
|
||||
|
||||
public void shouldAcceptRawDevfileUrl(String devfileName) {
|
||||
// when
|
||||
boolean result =
|
||||
rawDevfileUrlFactoryParameterResolver.accept(
|
||||
|
|
@ -186,6 +173,17 @@ public class RawDevfileUrlFactoryParameterResolverTest {
|
|||
assertTrue(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotAcceptRawDevfileUrl() {
|
||||
// when
|
||||
boolean result =
|
||||
rawDevfileUrlFactoryParameterResolver.accept(
|
||||
Collections.singletonMap(URL_PARAMETER_NAME, "https://host/user/repo.git"));
|
||||
|
||||
// then
|
||||
assertFalse(result);
|
||||
}
|
||||
|
||||
@DataProvider(name = "invalidURLsProvider")
|
||||
private Object[][] invalidUrlsProvider() {
|
||||
return new Object[][] {
|
||||
|
|
@ -200,6 +198,6 @@ public class RawDevfileUrlFactoryParameterResolverTest {
|
|||
|
||||
@DataProvider(name = "devfileNames")
|
||||
private Object[] devfileNames() {
|
||||
return new String[] {"devfile.yaml", ".devfile.yaml"};
|
||||
return new String[] {"devfile.yaml", ".devfile.yaml", "any-name.yaml", "any-name.yml"};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue