Skip to content

Instantly share code, notes, and snippets.

@snormore
Last active February 16, 2023 09:57
Show Gist options
  • Select an option

  • Save snormore/36eb05b675f399af6b18e960488440e4 to your computer and use it in GitHub Desktop.

Select an option

Save snormore/36eb05b675f399af6b18e960488440e4 to your computer and use it in GitHub Desktop.

Revisions

  1. snormore revised this gist Mar 1, 2019. 2 changed files with 28 additions and 57 deletions.
    57 changes: 0 additions & 57 deletions .circleci-config.yaml
    Original file line number Diff line number Diff line change
    @@ -1,57 +0,0 @@
    version: 2
    jobs:
    build:
    working_directory: /go/src/github.com/your_company/your_project
    docker:
    - image: golang:1.11
    environment:
    - GOCACHE: "/tmp/go/cache"
    - DEP_VERSION: 0.4.1
    steps:
    - checkout
    - setup_remote_docker:
    docker_layer_caching: true
    - run:
    name: Install Docker Client
    command: |
    set -x
    VER="17.03.0-ce"
    curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
    tar -xz -C /tmp -f /tmp/docker-$VER.tgz
    mv /tmp/docker/* /usr/bin
    - restore_cache:
    key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
    paths:
    - /go/src/github.com/your_company/your_project/vendor
    - run:
    name: Install Golang Packages
    command: |
    if [ ! -d /go/src/github.com/your_company/your_project/vendor ]; then
    curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
    /go/bin/dep ensure
    fi
    - save_cache:
    key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
    paths:
    - /go/src/github.com/your_company/your_project/vendor
    - restore_cache:
    keys:
    - build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
    paths:
    - /tmp/go/cache
    - run:
    name: Setup Kubernetes Cluster (kind)
    command: |
    go get github.com/kubernetes-sigs/kind
    kind create cluster --name="1"
    export KUBECONFIG="$(kind get kubeconfig-path --name="1")"
    - run:
    name: Run Tests
    command: make test
    - run:
    name: Build
    command: make build
    - save_cache:
    key: build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }}
    paths:
    - /tmp/go/cache
    28 changes: 28 additions & 0 deletions kind-circleci-config.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    version: 2
    jobs:
    build:
    machine: true
    steps:
    - checkout
    - run:
    name: Install KinD
    command: |
    curl -Lo kind https://github.com/kubernetes-sigs/kind/releases/download/0.0.1/kind-linux-amd64
    chmod +x kind
    sudo mv kind /usr/local/bin/
    - run:
    name: Create Kubernetes Cluster
    command: |
    kind create cluster
    - run:
    name: Install kubectl
    command: |
    curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl
    chmod +x kubectl
    sudo mv kubectl /usr/local/bin/
    - run:
    name: Run Tests
    command: |
    export KUBECONFIG="$(kind get kubeconfig-path)"
    kubectl cluster-info
    kubectl get pods --all-namespaces
  2. snormore revised this gist Jan 4, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions .circleci-config.yaml
    Original file line number Diff line number Diff line change
    @@ -22,18 +22,18 @@ jobs:
    - restore_cache:
    key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
    paths:
    - /go/src/github.com/your_comany/your_projecte/vendor
    - /go/src/github.com/your_company/your_project/vendor
    - run:
    name: Install Golang Packages
    command: |
    if [ ! -d /go/src/github.com/your_comany/your_projecte/vendor ]; then
    if [ ! -d /go/src/github.com/your_company/your_project/vendor ]; then
    curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
    /go/bin/dep ensure
    fi
    - save_cache:
    key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
    paths:
    - /go/src/github.com/your_comany/your_projecte/vendor
    - /go/src/github.com/your_company/your_project/vendor
    - restore_cache:
    keys:
    - build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
  3. snormore revised this gist Jan 4, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .circleci-config.yaml
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    version: 2
    jobs:
    build:
    working_directory: /go/src/github.com/your_comany/your_project
    working_directory: /go/src/github.com/your_company/your_project
    docker:
    - image: golang:1.11
    environment:
  4. snormore created this gist Jan 4, 2019.
    57 changes: 57 additions & 0 deletions .circleci-config.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    version: 2
    jobs:
    build:
    working_directory: /go/src/github.com/your_comany/your_project
    docker:
    - image: golang:1.11
    environment:
    - GOCACHE: "/tmp/go/cache"
    - DEP_VERSION: 0.4.1
    steps:
    - checkout
    - setup_remote_docker:
    docker_layer_caching: true
    - run:
    name: Install Docker Client
    command: |
    set -x
    VER="17.03.0-ce"
    curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
    tar -xz -C /tmp -f /tmp/docker-$VER.tgz
    mv /tmp/docker/* /usr/bin
    - restore_cache:
    key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
    paths:
    - /go/src/github.com/your_comany/your_projecte/vendor
    - run:
    name: Install Golang Packages
    command: |
    if [ ! -d /go/src/github.com/your_comany/your_projecte/vendor ]; then
    curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
    /go/bin/dep ensure
    fi
    - save_cache:
    key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
    paths:
    - /go/src/github.com/your_comany/your_projecte/vendor
    - restore_cache:
    keys:
    - build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
    paths:
    - /tmp/go/cache
    - run:
    name: Setup Kubernetes Cluster (kind)
    command: |
    go get github.com/kubernetes-sigs/kind
    kind create cluster --name="1"
    export KUBECONFIG="$(kind get kubeconfig-path --name="1")"
    - run:
    name: Run Tests
    command: make test
    - run:
    name: Build
    command: make build
    - save_cache:
    key: build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }}
    paths:
    - /tmp/go/cache