Skip to content

Commit

Permalink
feat: enhance devcontainer and refactor (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
avtakkar authored Mar 21, 2024
1 parent 8c53c30 commit 0e3a9ec
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 26 deletions.
14 changes: 11 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# This is a dockerfile specifically for running as a devcontainer
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.22-fips-cbl-mariner2.0
RUN tdnf update -y && tdnf install make -y && tdnf install git -y && tdnf install gawk -y && tdnf install jq -y
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.22-bookworm
RUN apt-get update -y && \
apt-get install make -y && \
apt-get install git -y && \
apt-get install gawk -y && \
apt-get install jq -y && \
apt-get install gettext-base -y

RUN go install github.com/cweill/gotests/gotests@latest && \
go install github.com/fatih/gomodifytags@latest && \
Expand All @@ -13,7 +18,10 @@ RUN go install github.com/cweill/gotests/gotests@latest && \
go install gotest.tools/gotestsum@latest && \
go install github.com/jandelgado/gcov2lcov@latest && \
go install github.com/AlekSi/gocov-xml@latest && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.54.2
go install sigs.k8s.io/[email protected] && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.54.2 && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && chmod +x kubectl && mkdir -p ~/.local/bin && mv ./kubectl /usr/local/bin/kubectl && \
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 700 get_helm.sh && ./get_helm.sh

RUN mkdir -p /go/src/github.com/azure/peerd

Expand Down
7 changes: 6 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@
"editor.formatOnSave": true
}
}
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"workspaceFolder": "${localWorkspaceFolder}",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind"
}
4 changes: 2 additions & 2 deletions .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: sudo make tests-deps-install

- name: "End to End: Blobs"
run: make build-image tests-random-image && docker system prune -f && make kind-create kind-deploy kind-test-random
run: make ci-kind-random

- name: "Clean up"
run: make kind-delete
Expand All @@ -30,7 +30,7 @@ jobs:
run: sudo make tests-deps-install

- name: "End to End: Ctr"
run: make build-image tests-random-image && docker system prune -f && make kind-create kind-deploy kind-test-ctr
run: make ci-kind-ctr

- name: "Clean up"
run: make kind-delete
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ jobs:
- name: 'Make'
if: ${{ success() }}
run: |
PEERD_IMAGE_TAG=${{ env.TAG }} make tests-deps-install tests-ci-aks
PEERD_IMAGE_TAG=${{ env.TAG }} make tests-deps-install ci-aks-ctr
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The `peerd` container image is available at `ghcr.io/azure/acr/peerd`. To deploy
```bash
CLUSTER_CONTEXT=<your-cluster-context> && \
TAG=v0.0.2-alpha && \
TAG=v0.0.3-alpha && \
HELM_RELEASE_NAME=peerd && \
HELM_CHART_DIR=./build/package/peerd-helm && \
helm --kube-context=$CLUSTER_CONTEXT install --wait $HELM_RELEASE_NAME $HELM_CHART_DIR \
Expand All @@ -69,7 +69,7 @@ as well, run the following.
```bash
CLUSTER_CONTEXT=<your-cluster-context> && \
TAG=v0.0.2-alpha && \
TAG=v0.0.3-alpha && \
HELM_RELEASE_NAME=peerd && \
HELM_CHART_DIR=./build/package/peerd-helm && \
helm --kube-context=$CLUSTER_CONTEXT install --wait $HELM_RELEASE_NAME $HELM_CHART_DIR \
Expand Down Expand Up @@ -128,8 +128,7 @@ There are two kinds of test workloads available in this repository:
of downloads and error rates.

```bash
$ make build-image tests-random-image && \
make kind-create kind-deploy kind-test-random
$ make ci-kind-random
...
{"level":"info","node":"random-zb9vm","version":"bb7ee6a","mode":"upstream","size":22980743,"readsPerBlob":5,"time":"2024-03-07T21:50:29Z","message":"downloading blob"}
{"level":"info","node":"random-9gcvw","version":"bb7ee6a","upstream.p50":21.25170790666404,"upstream.p75":5.834663359546446,"upstream.p90":0.7871542327673121,"upstream.p95":0.2965091294200036,"upstream.p100":0.2645602612715345,"time":"2024-03-07T21:50:34Z","message":"speeds (MB/s)"}
Expand All @@ -148,8 +147,7 @@ There are two kinds of test workloads available in this repository:
of downloads and error rates.

```bash
$ make build-image tests-scanner-image && \
make kind-create kind-deploy kind-test-ctr
$ make ci-kind-ctr
...
...
...
Expand Down
32 changes: 19 additions & 13 deletions build/ci/Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
.PHONY: tests-deps-install
tests-deps-install: ## Install dependencies for testing (supported only on Ubuntu)
@echo "+ $@"
sudo $(SCRIPTS_DIR)/install-deps.sh

.PHONY: kind-create
kind-create: ## Creates a kind cluster
kind-create:
@echo "+ $@"
@( $(SCRIPTS_DIR)/kind.sh cluster create -y )

.PHONY: kind-get
kind-get: ## Shows the current kind cluster
kind-get:
@echo "+ $@"
@( $(SCRIPTS_DIR)/kind.sh cluster get -y )

.PHONY: kind-delete
kind-delete: ## Deletes kind cluster
kind-delete:
@echo "+ $@"
@( $(SCRIPTS_DIR)/kind.sh cluster delete -y )

.PHONY: kind-deploy
kind-deploy: ## Deploys the p2p application to kind cluster
kind-deploy:
@echo "+ $@"
ifndef CONTAINER_REGISTRY
$(eval CONTAINER_REGISTRY := $(shell echo "localhost"))
endif
@( $(SCRIPTS_DIR)/kind.sh app deploy -y $(CONTAINER_REGISTRY)/peerd:dev )

.PHONY: kind-test-ctr
kind-test-ctr: ## Deploys test 'ctr' to the kind cluster
kind-test-ctr:
@echo "+ $@"
@( $(SCRIPTS_DIR)/kind.sh test ctr -y )

.PHONY: kind-test-random
kind-test-random: ## Deploys test 'random' to the kind cluster
kind-test-random:
@echo "+ $@"
ifndef CONTAINER_REGISTRY
$(eval CONTAINER_REGISTRY := $(shell echo "localhost"))
endif
@( $(SCRIPTS_DIR)/kind.sh test random -y $(CONTAINER_REGISTRY)/random:dev )

.PHONY: tests-ci-aks
tests-ci-aks: ## Run CI in AKS
.PHONY: tests-deps-install
tests-deps-install: ## Install dependencies for testing (supported only on Ubuntu)
@echo "+ $@"
sudo $(SCRIPTS_DIR)/install-deps.sh

.PHONY: ci-kind-ctr
ci-kind-ctr: build-image kind-delete kind-create kind-deploy kind-test-ctr ## Run the containerd hosts CI in kind.

.PHONY: ci-kind-random
ci-kind-random: build-image tests-random-image kind-delete kind-create kind-deploy kind-test-random ## Run the blobs range CI in kind.

.PHONY: ci-aks-ctr
ci-aks-ctr: ## Run the containerd hosts CI in AKS.
@echo "+ $@"
ifndef NODEPOOL
$(eval NODEPOOL := $(shell date +"p2p%y%m%d"))
Expand Down

0 comments on commit 0e3a9ec

Please sign in to comment.