Skip to content

Eliminando registros de Coder del mes correspondientes a septiembre 2… #111

Eliminando registros de Coder del mes correspondientes a septiembre 2…

Eliminando registros de Coder del mes correspondientes a septiembre 2… #111

name: Build containers
on:
push:
branches:
- main
- release
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Build docker containers
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
TAG: ${{ github.sha }}
run: |
docker compose --file=docker-compose.k8s.yml build \
--build-arg BRANCH=${{ steps.extract_branch.outputs.branch }} \
frontend \
frontend-sidecar \
nginx \
php
- name: Push containers to GitHub registry
run: |
echo "${{ github.token }}" | \
docker login https://docker.pkg.github.com "--username=${{ github.actor }}" --password-stdin
for container in frontend frontend-sidecar nginx php; do
for tag in "latest-${{ steps.extract_branch.outputs.branch }}" "${{ github.sha }}"; do
container_name="docker.pkg.github.com/${{ github.repository }}/${container}:${tag}"
docker tag "omegaup/${container}:${{ github.sha }}" "${container_name}"
docker push "${container_name}"
done
done
- name: Push containers to Docker registry
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | \
docker login "--username=${{ secrets.DOCKER_USERNAME }}" --password-stdin
for container in frontend frontend-sidecar nginx php; do
docker push "omegaup/${container}:${{ github.sha }}"
container_name="omegaup/${container}:latest-${{ steps.extract_branch.outputs.branch }}"
docker tag "omegaup/${container}:${{ github.sha }}" "${container_name}"
docker push "${container_name}"
done
- name: Update k8s sandbox manifests
if: ${{ github.ref == 'refs/heads/main' }}
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/
git clone --depth=1 https://omegaup-bot:${{ secrets.OMEGAUPBOT_RELEASE_TOKEN }}@github.com/omegaup/prod /tmp/prod
TAG=${{ github.sha }}
(cd /tmp/prod/k8s/omegaup/overlays/sandbox/frontend &&
git config --local user.name "omegaup-bot" && \
git config --local user.email "[email protected]" && \
kustomize edit set image \
omegaup/php:${TAG} \
omegaup/nginx:${TAG} \
omegaup/frontend:${TAG} \
omegaup/frontend-sidecar:${TAG} &&
sed -i "s/app.kubernetes.io\/version: .*/app.kubernetes.io\/version: ${TAG}/" frontend-deployment.yaml &&
git commit -am "omegaUp sandbox release ${TAG}" &&
git push)
rm -rf /tmp/prod
- name: Update k8s manifests
if: ${{ github.ref == 'refs/heads/release' }}
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/
git clone --depth=1 https://omegaup-bot:${{ secrets.OMEGAUPBOT_RELEASE_TOKEN }}@github.com/omegaup/prod /tmp/prod
TAG=${{ github.sha }}
(cd /tmp/prod/k8s/omegaup/overlays/production/frontend &&
git config --local user.name "omegaup-bot" && \
git config --local user.email "[email protected]" && \
kustomize edit set image \
omegaup/php:${TAG} \
omegaup/nginx:${TAG} \
omegaup/frontend:${TAG} \
omegaup/frontend-sidecar:${TAG} &&
sed -i "s/app.kubernetes.io\/version: .*/app.kubernetes.io\/version: ${TAG}/" frontend-deployment.yaml &&
git commit -am "omegaUp production release ${TAG}" &&
git push)
rm -rf /tmp/prod