diff --git a/.github/workflows/deploy-to-staging.yaml.disabled b/.github/workflows/deploy-to-staging.yaml.disabled new file mode 100644 index 000000000..c72f4db5b --- /dev/null +++ b/.github/workflows/deploy-to-staging.yaml.disabled @@ -0,0 +1,94 @@ +name: Deploy images to staging hubs +# use echo ${VAR##*: } to get the value of a variable that is a string with a colon in it +on: + workflow_dispatch: + push: + branches: + - staging + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Get PR labels + id: pr-labels + uses: irby/get-labels-on-push@v1.0.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check out the image repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Pull out any hubs that need deploying from the labels on the merge commit to staging + run: | + echo "PR labels: ${{ steps.pr-labels.outputs.labels }}" + HUBS=() + for label in $(echo -e "${{ steps.pr-labels.outputs.labels }}"); do + if [[ "$label" == hub-* ]]; then + label=$(echo $label | awk -F'-' '{print $2}') + HUBS+="$label" + echo "DEPLOY=1" >> $GITHUB_ENV + fi + done + echo "Hubs to deploy: $HUBS" + echo "DEPLOY_HUBS=${HUBS[@]}" >> $GITHUB_ENV + + - name: Setup python + if: ${{ env.DEPLOY }} + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + if: ${{ env.DEPLOY }} + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install --force-reinstall git+https://github.com/shaneknapp/hubploy.git@major-refactor + + - name: Auth to gcloud + if: ${{ env.DEPLOY }} + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GKE_KEY }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + + - name: Install Google Cloud SDK + if: ${{ env.DEPLOY }} + uses: google-github-actions/setup-gcloud@v2 + with: + install_components: 'gke-gcloud-auth-plugin' + + - name: Install SOPS + if: ${{ env.DEPLOY }} + run: | + mkdir -p ${HOME}/bin + curl -sSL https://github.com/getsops/sops/releases/download/v3.9.0/sops-v3.9.0.linux.amd64 -o ${HOME}/bin/sops + chmod 755 ${HOME}/bin/sops + echo "${HOME}/bin" >> $GITHUB_PATH + + - name: Store SOPS secret in a file + if: ${{ env.DEPLOY }} + run: | + cat << EOF > ${HOME}/sops.key + ${{ secrets.SOPS_KEY }} + EOF + echo "GOOGLE_APPLICATION_CREDENTIALS=${HOME}/sops.key" >> $GITHUB_ENV + + - name: Install Helm + if: ${{ env.DEPLOY }} + run: | + curl -L https://get.helm.sh/helm-v3.13.3-linux-amd64.tar.gz | tar -xzf - + mv linux-amd64/helm /usr/local/bin + helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/ + helm repo update + + - name: Deploy hubs to staging + if: ${{ env.DEPLOY }} + run: | + for hub in $(echo -e "${{ env.DEPLOY_HUBS }}"); do + echo "Deploying $hub to staging" + hubploy --verbose deploy $hub hub staging + done diff --git a/.github/workflows/yaml-lint.yaml b/.github/workflows/yaml-lint.yaml new file mode 100644 index 000000000..787d5e3fa --- /dev/null +++ b/.github/workflows/yaml-lint.yaml @@ -0,0 +1,15 @@ +name: "Yaml lint" +on: + - pull_request # yamllint disable-line rule:truthy + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install yamllint + run: pip install yamllint==1.35.1 + + - name: Lint YAML files + run: yamllint --no-warnings . diff --git a/deployments/logodev/hubploy.yaml b/deployments/logodev/hubploy.yaml index 7760f94a1..f6a83f0fd 100644 --- a/deployments/logodev/hubploy.yaml +++ b/deployments/logodev/hubploy.yaml @@ -1,15 +1,7 @@ images: images: # temporary update - - name: us-central1-docker.pkg.dev/ucb-datahub-2018/user-images/logodev-user-image:a02e39fbaedb - path: image/ - repo2docker: - base_image: docker.io/library/buildpack-deps:jammy - registry: - provider: gcloud - gcloud: - project: ucb-datahub-2018 - service_key: gcr-key.json + - name: us-central1-docker.pkg.dev/ucb-datahub-2018/user-images/logodev-user-image:a9443779a3a9 cluster: provider: gcloud diff --git a/requirements.txt b/requirements.txt index da3a1ba42..4eacc64bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ chardet requests==2.31.0 # requests==2.32.3 urllib3<2.0.0 +yamllint==1.35.1 diff --git a/vendor/google/ugr/README.md b/vendor/google/ugr/README.md index 4ca1367d6..7d1667975 100644 --- a/vendor/google/ugr/README.md +++ b/vendor/google/ugr/README.md @@ -85,4 +85,6 @@ Run the shell script to deploy: ## Change a deployment -To change an existing deployment, edit the parameters to be changed in the deployment's yaml config and run its associated shell script. \ No newline at end of file +To change an existing deployment, edit the parameters to be changed in the deployment's yaml config and run its associated shell script. + +Note that not all parameters can be updated in place. For example, node pool autoscaling (such as min/max numbers and on/off) can be updated on the "hot" deployment, but other config settings (e.g., machine type and disk size) require the resources to first be undeployed, then deployed anew with the new configuration.