Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Reduces total build time from 2h15 to 1h35 #9813

Merged
merged 6 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
ci: Make CI faster
Signed-off-by: Alex Collins <[email protected]>
  • Loading branch information
alexec committed Oct 13, 2022
commit 1866064b3df90f9eda79686789e2a188b5ea1523
49 changes: 21 additions & 28 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,20 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx
- name: build argoexec-image
run: |
docker buildx build \
-t quay.io/argoproj/argoexec:latest \
--target argoexec \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache-new" \
--output=type=docker \
.
- run: docker save quay.io/argoproj/argoexec:latest > /tmp/argoexec_image.tar
- name: Build and export
uses: docker/build-push-action@v3
with:
context: .
tags: quay.io/argoproj/argoexec:latest
outputs: type=docker,dest=/tmp/argoexec_image.tar
target: argoexec
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: actions/upload-artifact@v3
with:
name: argoexec
path: /tmp/argoexec_image.tar
if-no-files-found: error
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

e2e-tests:
name: E2E Tests
Expand Down Expand Up @@ -131,18 +116,20 @@ jobs:
${{ runner.os }}-go-
- name: Install and start K3S
run: |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.2+k3s1 INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh -
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh -
until kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml cluster-info ; do sleep 10s ; done
cp /etc/rancher/k3s/k3s.yaml /home/runner/.kubeconfig
echo "- name: fake_token_user" >> $KUBECONFIG
echo " user:" >> $KUBECONFIG
echo " token: xxxxxx" >> $KUBECONFIG
until kubectl cluster-info ; do sleep 10s ; done
- uses: actions/download-artifact@v3
name: Download argoexec image
with:
name: argoexec
path: /tmp
- run: docker load < /tmp/argoexec_image.tar
name: Load argoexec image
- name: Set-up /etc/hosts
run: |
echo '127.0.0.1 dex' | sudo tee -a /etc/hosts
Expand All @@ -151,20 +138,26 @@ jobs:
echo '127.0.0.1 mysql' | sudo tee -a /etc/hosts
echo '127.0.0.1 azurite' | sudo tee -a /etc/hosts
- run: make install PROFILE=${{matrix.profile}} STATIC_FILES=false
name: Install manifests
- run: make controller $(go env GOPATH)/bin/goreman STATIC_FILES=false
name: Build controller
- run: make cli STATIC_FILES=false
if: ${{matrix.test == 'test-api' || matrix.test == 'test-cli' || matrix.test == 'test-java-sdk' || matrix.test == 'test-python-sdk'}}
- run: make start PROFILE=${{matrix.profile}} AUTH_MODE=client STATIC_FILES=false LOG_LEVEL=info API=${{matrix.test == 'test-api' || matrix.test == 'test-cli' || matrix.test == 'test-java-sdk' || matrix.test == 'test-python-sdk'}} UI=false AZURE=true > /tmp/argo.log 2>&1 &
name: Build CLI
- run: make start PROFILE=${{matrix.profile}} AUTH_MODE=client STATIC_FILES=false LOG_LEVEL=info API=${{matrix.test == 'test-api' || matrix.test == 'test-cli' || matrix.test == 'test-java-sdk' || matrix.test == 'test-python-sdk'}} UI=false LOGS=false > /tmp/argo.log 2>&1 &
name: Start controller/API
- run: make wait
timeout-minutes: 4
- name: make ${{matrix.test}}
name: Wait for MinIO/MySQL etc to be ready
- name: Run tests ${{matrix.test}}
# https://github.com/marketplace/actions/retry-step
uses: nick-fields/[email protected]
with:
timeout_minutes: 20
max_attempts: 2
command: make ${{matrix.test}} E2E_SUITE_TIMEOUT=20m STATIC_FILES=false AZURE=true
command: make ${{matrix.test}} E2E_SUITE_TIMEOUT=20m STATIC_FILES=false
- if: ${{ failure() }}
name: Controller/API logs
run: |
[ -e /tmp/argo.log ] && cat /tmp/argo.log

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/sdks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ permissions:
jobs:
sdk:
permissions:
contents: read
packages: write # for publishing packages
contents: write # for creating releases
if: github.repository == 'argoproj/argo-workflows'
Expand Down
11 changes: 2 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ AUTH_MODE := hybrid
ifeq ($(PROFILE),sso)
AUTH_MODE := sso
endif
# whether or not to start the Azurite test service for Azure Blob Storage
AZURE := false

# Which mode to run in:
# * `local` run the workflow–controller and argo-server as single replicas on the local machine (default)
Expand All @@ -94,7 +92,7 @@ ALWAYS_OFFLOAD_NODE_STATUS := false

$(info GIT_COMMIT=$(GIT_COMMIT) GIT_BRANCH=$(GIT_BRANCH) GIT_TAG=$(GIT_TAG) GIT_TREE_STATE=$(GIT_TREE_STATE) RELEASE_TAG=$(RELEASE_TAG) DEV_BRANCH=$(DEV_BRANCH) VERSION=$(VERSION))
$(info KUBECTX=$(KUBECTX) DOCKER_DESKTOP=$(DOCKER_DESKTOP) K3D=$(K3D) DOCKER_PUSH=$(DOCKER_PUSH))
$(info RUN_MODE=$(RUN_MODE) PROFILE=$(PROFILE) AUTH_MODE=$(AUTH_MODE) SECURE=$(SECURE) STATIC_FILES=$(STATIC_FILES) ALWAYS_OFFLOAD_NODE_STATUS=$(ALWAYS_OFFLOAD_NODE_STATUS) UPPERIO_DB_DEBUG=$(UPPERIO_DB_DEBUG) LOG_LEVEL=$(LOG_LEVEL) NAMESPACED=$(NAMESPACED) AZURE=$(AZURE))
$(info RUN_MODE=$(RUN_MODE) PROFILE=$(PROFILE) AUTH_MODE=$(AUTH_MODE) SECURE=$(SECURE) STATIC_FILES=$(STATIC_FILES) ALWAYS_OFFLOAD_NODE_STATUS=$(ALWAYS_OFFLOAD_NODE_STATUS) UPPERIO_DB_DEBUG=$(UPPERIO_DB_DEBUG) LOG_LEVEL=$(LOG_LEVEL) NAMESPACED=$(NAMESPACED))

override LDFLAGS += \
-X github.com/argoproj/argo-workflows/v3.version=$(VERSION) \
Expand Down Expand Up @@ -433,9 +431,6 @@ ifeq ($(RUN_MODE),kubernetes)
kubectl -n $(KUBE_NAMESPACE) scale deploy/workflow-controller --replicas 1
kubectl -n $(KUBE_NAMESPACE) scale deploy/argo-server --replicas 1
endif
ifeq ($(AZURE),true)
kubectl -n $(KUBE_NAMESPACE) apply -f test/e2e/azure/deploy-azurite.yaml
endif

.PHONY: argosay
argosay:
Expand Down Expand Up @@ -464,7 +459,7 @@ endif
else
start: install
endif
@echo "starting STATIC_FILES=$(STATIC_FILES) (DEV_BRANCH=$(DEV_BRANCH), GIT_BRANCH=$(GIT_BRANCH)), AUTH_MODE=$(AUTH_MODE), RUN_MODE=$(RUN_MODE), MANAGED_NAMESPACE=$(MANAGED_NAMESPACE), AZURE=$(AZURE)"
@echo "starting STATIC_FILES=$(STATIC_FILES) (DEV_BRANCH=$(DEV_BRANCH), GIT_BRANCH=$(GIT_BRANCH)), AUTH_MODE=$(AUTH_MODE), RUN_MODE=$(RUN_MODE), MANAGED_NAMESPACE=$(MANAGED_NAMESPACE)"
ifneq ($(CTRL),true)
@echo "⚠️️ not starting controller. If you want to test the controller, use 'make start CTRL=true' to start it"
endif
Expand All @@ -484,9 +479,7 @@ endif
ifeq ($(AUTH_MODE),sso)
grep '127.0.0.1.*dex' /etc/hosts
endif
ifeq ($(AZURE),true)
grep '127.0.0.1.*azurite' /etc/hosts
endif
grep '127.0.0.1.*minio' /etc/hosts
grep '127.0.0.1.*postgres' /etc/hosts
grep '127.0.0.1.*mysql' /etc/hosts
Expand Down
11 changes: 3 additions & 8 deletions docs/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ Start up Argo Workflows using the following:
make start PROFILE=mysql AUTH_MODE=client STATIC_FILES=false API=true
```

If you want to run Azure tests against a local Azurite, add `AZURE=true`:
If you want to run Azure tests against a local Azurite:

```bash
make start PROFILE=mysql AUTH_MODE=client STATIC_FILES=false API=true AZURE=true
kubectl -n $(KUBE_NAMESPACE) apply -f test/e2e/azure/deploy-azurite.yaml
make start
```

#### Running One Test
Expand All @@ -166,12 +167,6 @@ Find the test that you want to run in `test/e2e`
make TestArtifactServer
```

If you wish to include tests against Azure Storage, define `AZURE=true`:

```bash
make AZURE=true TestArtifactServer
```

#### Running A Set Of Tests

You can find the build tag at the top of the test file.
Expand Down
20 changes: 0 additions & 20 deletions test/e2e/argo_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,26 +1060,6 @@ func (s *ArgoServerSuite) TestArtifactServer() {
s.artifactServerRetrievalTests(name, uid)
}

func (s *ArgoServerSuite) TestArtifactServerAzure() {
if os.Getenv("AZURE") != "true" {
s.T().Skip("AZURE must be true to run Azure Storage e2e tests")
}
var uid types.UID
var name string
s.Given().
Workflow(`@testdata/artifact-workflow-azure.yaml`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeArchived).
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
name = metadata.Name
uid = metadata.UID
})

s.artifactServerRetrievalTests(name, uid)
}

func (s *ArgoServerSuite) artifactServerRetrievalTests(name string, uid types.UID) {
s.Run("GetArtifact", func() {
resp := s.e().GET("/artifacts/argo/" + name + "/" + name + "/main-file").
Expand Down
76 changes: 68 additions & 8 deletions test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1356,18 +1356,78 @@ func (s *CLISuite) TestWorkflowTemplateRefSubmit() {
}

func (s *CLISuite) TestWorkflowCopyArtifact() {
s.workflowCopyArtifactTests("basic-artifact-workflow.yaml")
}
var workflowFileName string = "basic-artifact-workflow.yaml"
s.Given().
Workflow(fmt.Sprintf("@testdata/%s", workflowFileName)).
When().
SubmitWorkflow().
WaitForWorkflow().
Given().
RunCli([]string{"cp", "@latest", "outputDir"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.Contains(t, output, "Created \"main.log\"")
assert.Contains(t, output, "Created \"hello_world.tgz\"")
assert.Contains(t, output, "Created \"bye_world.tgz\"")
}
})
os.RemoveAll("outputDir")

func (s *CLISuite) TestWorkflowCopyArtifactAzure() {
if os.Getenv("AZURE") != "true" {
s.T().Skip("AZURE must be true to run Azure Storage e2e tests")
}
s.Given().
Workflow(fmt.Sprintf("@testdata/%s", workflowFileName)).
When().
SubmitWorkflow().
WaitForWorkflow().
Given().
RunCli([]string{"cp", "@latest", "outputDir", "--template-name", "bye"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.Contains(t, output, "Created \"main.log\"")
assert.Contains(t, output, "Created \"bye_world.tgz\"")
assert.NotContains(t, output, "Created \"hello_world.tgz\"")
}
})
os.RemoveAll("outputDir")

s.workflowCopyArtifactTests("basic-artifact-workflow-azure.yaml")
s.Given().
Workflow(fmt.Sprintf("@testdata/%s", workflowFileName)).
When().
SubmitWorkflow().
WaitForWorkflow().
Given().
RunCli([]string{"cp", "@latest", "outputDir", "--artifact-name", "hello_world"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.NotContains(t, output, "Created \"main.log\"")
assert.NotContains(t, output, "Created \"bye_world.tgz\"")
assert.Contains(t, output, "Created \"hello_world.tgz\"")
}
})
os.RemoveAll("outputDir")

s.Given().
Workflow(fmt.Sprintf("@testdata/%s", workflowFileName)).
When().
SubmitWorkflow().
WaitForWorkflow().
Given().
RunCli([]string{"cp", "@latest", ".", "--path", "/{templateName}/{artifactName}/"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
//Assert everything was stored
assert.Contains(t, output, "Created \"main.log\"")
assert.Contains(t, output, "Created \"bye_world.tgz\"")
assert.Contains(t, output, "Created \"hello_world.tgz\"")
//Assert filepaths are correct
statStrip := func(f os.FileInfo, err error) error {
return err
}
assert.NoError(t, statStrip(os.Stat("bye/bye_world/bye_world.tgz")))
assert.NoError(t, statStrip(os.Stat("hello/hello_world/hello_world.tgz")))
}
})
os.RemoveAll("bye")
os.RemoveAll("hello")
}

func (s *CLISuite) workflowCopyArtifactTests(workflowFileName string) {
func (s *CLISuite) WorkflowCopyArtifactTests() {
workflowFileName := "basic-artifact-workflow.yaml"
s.Given().
Workflow(fmt.Sprintf("@testdata/%s", workflowFileName)).
When().
Expand Down
11 changes: 0 additions & 11 deletions test/e2e/manifests/plugins/kustomization.yaml

This file was deleted.