Explorar el Código

Merge pull request #602 from porter-dev/0.3.0-fix-ecr-repo-parsing

[0.3.0] Parse ECR repositories with forward slashes
abelanger5 hace 5 años
padre
commit
a405936fd8
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      dashboard/src/components/image-selector/TagList.tsx

+ 10 - 0
dashboard/src/components/image-selector/TagList.tsx

@@ -8,6 +8,8 @@ import { Context } from "shared/Context";
 
 import Loading from "../Loading";
 
+var ecrRepoRegex = /(^[a-zA-Z0-9][a-zA-Z0-9-_]*)\.dkr\.ecr(\-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.amazonaws\.com(\.cn)?/igm
+
 type PropsType = {
   setSelectedTag: (x: string) => void;
   selectedTag: string;
@@ -32,8 +34,16 @@ export default class TagList extends Component<PropsType, StateType> {
 
   componentDidMount() {
     const { currentProject } = this.context;
+
     let splits = this.props.selectedImageUrl.split("/");
     let repoName = splits[splits.length - 1];
+
+    let matches = this.props.selectedImageUrl.match(ecrRepoRegex)
+
+    if (matches) {
+      repoName = this.props.selectedImageUrl.split(/\/(.+)/)[1]
+    }
+  
     api
       .getImageTags(
         "<token>",