Browse Source

Use correct GH registry

Lucas Severo Alves 5 years ago
parent
commit
b605973c6a
2 changed files with 48 additions and 65 deletions
  1. 24 61
      .github/workflows/all.yml
  2. 24 4
      .github/workflows/main.yml

+ 24 - 61
.github/workflows/all.yml

@@ -38,6 +38,29 @@ jobs:
     - name: Vet and Build
       run: make manager
 
+  test:
+    name: Test
+    container: 
+      image: golang:1.15
+    runs-on: ubuntu-latest
+
+    steps:
+    - name: Check out code into the Go module directory
+      uses: actions/checkout@v2
+
+    - name: Get dependencies
+      run: |
+        go get -v -t -d ./...
+        
+    - name: Add kubebuilder
+      run:  |
+        curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${{env.KUBEBUILDER_VERSION}}/kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64.tar.gz > kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64.tar.gz
+        tar -xvf kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64.tar.gz
+        mv kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64 /usr/local/kubebuilder
+
+    - name: Check out code into the Go module directory
+      uses: actions/checkout@v2
+
     - name: Test
       run: make test
 
@@ -48,64 +71,4 @@ jobs:
         file: ./cover.out
         # flags: unittests # optional
         name: external-secrets
-        fail_ci_if_error: false
-
-  docker:
-    name: Docker
-    runs-on: ubuntu-latest
-    needs: build
-    steps:
-    - name: Prepare
-      id: prep
-      run: |
-        DOCKER_IMAGE=ghcr.io/external-secrets/external-secrets
-
-        VERSION=edge
-        if [[ $GITHUB_REF == refs/tags/* ]]; then
-          VERSION=${GITHUB_REF#refs/tags/}
-        elif [[ $GITHUB_REF == refs/heads/* ]]; then
-          VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
-        elif [[ $GITHUB_REF == refs/pull/* ]]; then
-          VERSION=pr-${{ github.event.number }}
-        fi
-
-        TAGS="${DOCKER_IMAGE}:${VERSION}"
-        if [ "${{ github.event_name }}" = "push" ]; then
-          TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
-        fi
-
-        echo ::set-output name=version::${VERSION}
-        echo ::set-output name=tags::${TAGS}
-        echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
-        echo ::set-output name=push_image::$PUSH_IMAGE
-
-    - name: Check out the repo
-      uses: actions/checkout@v2
-      
-    - name: Set up QEMU
-      id: qemu
-      uses: docker/setup-qemu-action@v1
-      with:
-        platforms: all
-
-    - name: Set up Docker Buildx
-      id: buildx
-      uses: docker/setup-buildx-action@v1
-      
-    - name: Build
-      id: docker_build
-      uses: docker/build-push-action@v2
-      with:
-        context: .
-        file: ./Dockerfile
-        builder: ${{ steps.buildx.outputs.name }}
-        platforms: linux/amd64
-        tags: ${{ steps.prep.outputs.tags }}
-        push: false
-        labels: |
-          org.opencontainers.image.source=${{ github.event.repository.clone_url }}
-          org.opencontainers.image.created=${{ steps.prep.outputs.created }}
-          org.opencontainers.image.revision=${{ github.sha }}
-          
-    - name: Image digest
-      run: echo ${{ steps.docker_build.outputs.digest }}
+        fail_ci_if_error: false

+ 24 - 4
.github/workflows/main.yml

@@ -36,6 +36,26 @@ jobs:
     - name: Vet and Build
       run: make manager
 
+  test:
+    name: Test
+    container: 
+      image: golang:1.15
+    runs-on: ubuntu-latest
+
+    steps:
+    - name: Check out code into the Go module directory
+      uses: actions/checkout@v2
+
+    - name: Get dependencies
+      run: |
+        go get -v -t -d ./...
+        
+    - name: Add kubebuilder
+      run:  |
+        curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${{env.KUBEBUILDER_VERSION}}/kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64.tar.gz > kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64.tar.gz
+        tar -xvf kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64.tar.gz
+        mv kubebuilder_${{env.KUBEBUILDER_VERSION}}_linux_amd64 /usr/local/kubebuilder
+
     - name: Test
       run: make test
 
@@ -51,7 +71,7 @@ jobs:
   docker:
     name: Docker
     runs-on: ubuntu-latest
-    needs: build
+    needs: [build, test]
     steps:
     - name: Prepare
       id: prep
@@ -103,9 +123,9 @@ jobs:
       id: docker-login
       uses: docker/login-action@v1
       with:
-        registry: docker.pkg.github.com
-        username: external-secrets
-        password: ${{ secrets.GITHUB_TOKEN }}
+        registry: ghcr.io
+        username: ${{ secrets.GHCR_USERNAME }}
+        password: ${{ secrets.GHCR_TOKEN }}
       if: ${{ steps.prep.outputs.push_image == 'true' }}
 
     - name: Build and push