Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ As of October 2020, GitHub Actions do not persist between different jobs in the
|-------------------------------|-----------|---------------------------------------------|-----------------------------|
| website public | build | deploy_website | share data between jobs |
| Docker Images | build | deploy, integration, integrations-config-db | share data between jobs |
| Frontend Protobuf | build | | long term storage |
| Caching Index Client Protobuf | build | | long term storage |
| Ring Protobuf | build | | long term storage |
| Rules Protobuf | build | | long term storage |

*Note:* Docker Images are zipped before uploading as a workaround. The images contain characters that are illegal in the upload-artifact action.
```yaml
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/scripts/install-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

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
97 changes: 87 additions & 10 deletions .github/workflows/test-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
tags:
- v[0-9]+.[0-9]+.[0-9]+** # Tag filters not as strict due to different regex system on Github Actions
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -13,6 +14,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
# Commands in the Makefile are hardcoded with an assumed file structure of the CI container
# Symlink ensures paths specified in previous commands don’t break
- name: Sym Link Expected Path to Workspace
run: |
mkdir -p /go/src/github.com/cortexproject/cortex
Expand Down Expand Up @@ -57,12 +60,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Docker Client
run: |
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
run: ./.github/workflows/scripts/install-docker.sh
- name: Sym Link Expected Path to Workspace
run: |
mkdir -p /go/src/github.com/cortexproject/cortex
Expand All @@ -80,10 +78,89 @@ jobs:
mkdir /tmp/images
ln -s /tmp/images ./docker-images
make BUILD_IN_CONTAINER=false save-images
- name: Zip Images
run: tar -zcvf images.tar.gz /tmp/images
- name: Upload Images Artifact
- name: Create Docker Images Archive
run: tar -cvf images.tar /tmp/images
- name: Upload Docker Images Artifact
uses: actions/upload-artifact@v2
with:
name: Docker Images
path: ./images.tar.gz
path: ./images.tar

integration:
needs: build
runs-on: ubuntu-16.04
steps:
- name: Upgrade golang
run: |
cd /tmp
wget https://dl.google.com/go/go1.14.9.linux-amd64.tar.gz
tar -zxvf go1.14.9.linux-amd64.tar.gz
sudo rm -fr /usr/local/go
sudo mv /tmp/go /usr/local/go
cd -
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Docker Client
run: sudo ./.github/workflows/scripts/install-docker.sh
- name: Sym Link Expected Path to Workspace
run: |
sudo mkdir -p /go/src/github.com/cortexproject/cortex
sudo ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/cortex
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking the directory instead of the contents of the folder did not work when we tested it.

- name: Download Docker Images Artifacts
uses: actions/download-artifact@v2
with:
name: Docker Images
- name: Extract Docker Images Archive
run: tar -xvf images.tar -C /
- name: Load Docker Images
run: |
ln -s /tmp/images ./docker-images
make BUILD_IN_CONTAINER=false load-images
- name: Preload Images
# We download docker images used by integration tests so that all images are available
# locally and the download time doesn't account in the test execution time, which is subject
# to a timeout
run: |
docker pull minio/minio:RELEASE.2019-12-30T05-45-39Z
docker pull amazon/dynamodb-local:1.11.477
docker pull consul:0.9
docker pull gcr.io/etcd-development/etcd:v3.4.7
docker pull quay.io/cortexproject/cortex:v1.0.0
docker pull quay.io/cortexproject/cortex:v1.1.0
docker pull quay.io/cortexproject/cortex:v1.2.0
docker pull quay.io/cortexproject/cortex:v1.3.0
docker pull quay.io/cortexproject/cortex:v1.4.0
docker pull shopify/bigtable-emulator:0.1.0
docker pull rinscy/cassandra:3.11.0
docker pull memcached:1.6.1
docker pull bouncestorage/swift-aio:55ba4331
- name: Integration Tests
run: |
export CORTEX_IMAGE_PREFIX="${IMAGE_PREFIX:-quay.io/cortexproject/}"
export CORTEX_IMAGE="${CORTEX_IMAGE_PREFIX}cortex:${TAG:-$(./tools/image-tag)}"
export CORTEX_CHECKOUT_DIR="/go/src/github.com/cortexproject/cortex"
echo "Running integration tests with image: $CORTEX_IMAGE"
go test -tags=requires_docker -timeout 1800s -v -count=1 ./integration/...
env:
IMAGE_PREFIX: ${{ secrets.IMAGE_PREFIX }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This secret will need to be added in the forked repo if one wants to change the image_prefix

TAG: ${{ github.event.push.tag_name }}

integration-configs-db:
needs: build
runs-on: ubuntu-16.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Docker Client
run: sudo ./.github/workflows/scripts/install-docker.sh
- name: Download Docker Images Artifact
uses: actions/download-artifact@v2
with:
name: Docker Images
- name: Extract Docker Images Archive
run: tar -xvf images.tar -C /
- name: Run Integration Configs Tests
run: |
touch build-image/.uptodate
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-build-image-debian-491e60715-WIP TTY='' configs-integration-test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment to explain why we need TTY='', please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default runners in GitHub Actions don't support TTY :( actions/runner#241 and a GitHub member responded saying its fairly low prio in their backlog.

This is what happens when we remove TTY='':

Screen Shot 2020-10-15 at 1 14 55 PM

However, there is a workaround we can do if you'd like it back: https://man7.org/linux/man-pages/man1/script.1.html
(script -e -c $COMMAND_HERE)
The snippet would be changed to:

   steps:
    - uses: actions/checkout@v1
      run: |
        touch build-image/.uptodate
        MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
        script -e -c "make BUILD_IMAGE=quay.io/cortexproject/build-image:upgrade-build-image-debian-491e60715-WIP configs-integration-test"

This works and enables the command to run with TTY but this seemed kind of hacky to me so I left it as TTY=''

Would you like us to change the line to use script -e -c or just add a comment saying GHA doesnt support TTY in their default runners yet

Copy link
Contributor

@pstibrany pstibrany Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think comment explaining why TTY='' is fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add a comment saying GHA doesnt support TTY in their default runners yet

Let's just add a comment, but not a block so you can do it in a following PR.