Skip to content

Commit

Permalink
Merge pull request #8128 from OpenMined/yash/fix-k8s-cron
Browse files Browse the repository at this point in the history
Bugfix Github actions, devspace & helm.py errors
  • Loading branch information
rasswanth-s authored Oct 4, 2023
2 parents 317dd51 + e1497b1 commit 9a30b96
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/cd-syft-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to Azure container registry
- name: Login to Azure CLI
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS_GITHUB_CI }}}

- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_SERVER }}
Expand All @@ -63,7 +68,7 @@ jobs:
shell: bash
run: echo "GRID_VERSION=$(python packages/grid/VERSION)" >> $GITHUB_OUTPUT

- name: Build and push `grid-backend` image to DockerHub
- name: Build and push `grid-backend` image to registry
uses: docker/build-push-action@v4
with:
context: ./packages
Expand All @@ -74,7 +79,7 @@ jobs:
${{ secrets.ACR_SERVER }}/openmined/grid-backend:dev
${{ secrets.ACR_SERVER }}/openmined/grid-backend:dev-${{ github.sha }}
- name: Build and push `grid-frontend` image to DockerHub
- name: Build and push `grid-frontend` image to registry
uses: docker/build-push-action@v4
with:
context: ./packages/grid/frontend
Expand All @@ -86,7 +91,7 @@ jobs:
target: grid-ui-development

# TODO: Re-enable once we have Enclave up and running
# - name: Build and push `grid-enclave` image to DockerHub
# - name: Build and push `grid-enclave` image to registry
# uses: docker/build-push-action@v4
# with:
# context: ./packages
Expand All @@ -97,7 +102,7 @@ jobs:
# ${{ secrets.ACR_SERVER }}/openmined/grid-enclave:dev
# ${{ secrets.ACR_SERVER }}/openmined/grid-enclave:dev-${{ github.sha }}

- name: Build and push `grid-headscale` image to DockerHub
- name: Build and push `grid-headscale` image to registry
uses: docker/build-push-action@v4
with:
context: ./packages/grid/vpn
Expand All @@ -107,7 +112,7 @@ jobs:
${{ secrets.ACR_SERVER }}/openmined/grid-headscale:dev
${{ secrets.ACR_SERVER }}/openmined/grid-headscale:dev-${{ github.sha }}
- name: Build and push `grid-tailscale` image to DockerHub
- name: Build and push `grid-tailscale` image to registry
uses: docker/build-push-action@v4
with:
context: ./packages/grid/vpn
Expand All @@ -117,7 +122,7 @@ jobs:
${{ secrets.ACR_SERVER }}/openmined/grid-tailscale:dev
${{ secrets.ACR_SERVER }}/openmined/grid-tailscale:dev-${{ github.sha }}
- name: Build and push `grid-vpn-iptables` image to DockerHub
- name: Build and push `grid-vpn-iptables` image to registry
uses: docker/build-push-action@v2
with:
context: ./packages/grid/vpn
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ js/node_modules/*

#nohup
nohup.out

# tox syft.build.helm generated file
out.txt
13 changes: 10 additions & 3 deletions packages/grid/helm/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def main() -> None:
)
args = parser.parse_args()
helm_dir = "helm"

text = args.file.read()
file_count = 0

# input_file = f"{helm_dir}/raw_manifests.yaml"
# with open(input_file, "w") as f:
Expand All @@ -115,12 +115,12 @@ def main() -> None:
)
input_data = "---\n" + "\n".join(lines[first_index - 1 :])
except StopIteration:
print("helm.py error: No line starting with 'apiVersion' found in the input.")
print("❌ Error: No line starting with 'apiVersion' found in the input.")
print("------------------------------")
print("Got input text:")
print(text)
print("------------------------------")
return
exit(1)

helm_chart_template_dir = f"{helm_dir}/syft/templates"

Expand Down Expand Up @@ -166,6 +166,13 @@ def main() -> None:

with open(new_file, "w") as f:
f.write(yaml_dump) # add document separator
file_count += 1

if file_count > 0:
print(f"✅ Done: Generated {file_count} template files")
else:
print("❌ Failed: Generated zero files. Check input file for errors.")
exit(1)


if __name__ == "__main__":
Expand Down
14 changes: 5 additions & 9 deletions packages/grid/helm/manifests.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
# Source: component-chart/templates/deployment.yaml
# Create headless service for StatefulSet
---

---
# Source: component-chart/templates/ingress.yaml
#


---

# Source: component-chart/templates/deployment.yaml
# Create headless service for StatefulSet
---
# Source: component-chart/templates/ingress.yaml
#


---
# Source: component-chart/templates/deployment.yaml
# Create headless service for StatefulSet
---

---
Expand Down Expand Up @@ -337,8 +337,7 @@ spec:
port:
number: 80
rules:
- host: ""
http:
- http:
paths:
- backend:
service:
Expand All @@ -347,9 +346,6 @@ spec:
number: 80
path: /
pathType: Prefix
tls:
- hosts:
- ""

---
# Source: component-chart/templates/service.yaml
Expand Down
7 changes: 5 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -763,12 +763,15 @@ commands =
bash -c 'k3d cluster create build || true && \
k3d cluster start build'

bash -c 'rm packages/grid/helm/syft/templates/* || true'
bash -c 'rm -rf packages/grid/helm/syft/templates/ && mkdir -p packages/grid/helm/syft/templates/'

bash -c 'cd packages/grid && \
[[ -n "$CONTAINER_REGISTRY" ]] && REGISTRY_FLAG="--var CONTAINER_REGISTRY=$CONTAINER_REGISTRY" || REGISTRY_FLAG="" && \
[[ -n "$VERSION" ]] && VERSION_FLAG="--var VERSION=$VERSION" || VERSION_FLAG="" && \
devspace deploy --render --skip-build --build-sequential --no-warn --silent ${REGISTRY_FLAG} ${VERSION_FLAG} --kube-context "k3d-build" 2>/dev/null | python3 helm/helm.py'
devspace deploy --render --skip-build --no-warn --silent ${REGISTRY_FLAG} ${VERSION_FLAG} --kube-context "k3d-build" > out.txt'

bash -c 'cd packages/grid && \
python3 helm/helm.py out.txt'

bash -c 'cd packages/grid/helm && \
helm lint syft'
Expand Down

0 comments on commit 9a30b96

Please sign in to comment.