Bump hashicorp/nomad from 2.3.1 to 2.4.0 in /terraform (#341) #658
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
changes-other-than: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
backupbot: | |
- '!**/backupbot.*' | |
outputs: | |
backupbot: ${{ steps.filter.outputs.backupbot }} | |
# This name is used by status check requirement | |
before-cd-test: | |
needs: changes-other-than | |
if: ${{ needs.changes-other-than.outputs.backupbot == 'true' }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup-cni | |
run: | | |
export ARCH_CNI=$( [ $(uname -m) = aarch64 ] && echo arm64 || echo amd64) | |
export CNI_PLUGIN_VERSION=v1.4.0 | |
curl -L -o cni-plugins.tgz "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGIN_VERSION}/cni-plugins-linux-${ARCH_CNI}-${CNI_PLUGIN_VERSION}".tgz | |
sudo mkdir -p /opt/cni/bin | |
sudo tar -C /opt/cni/bin -xzf cni-plugins.tgz | |
- name: Install Nomad and Consul | |
run: | | |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - | |
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | |
sudo apt-get update && sudo apt-get install -y nomad=1.8.1-1 consul | |
echo "nomad_version: $(nomad -v)" | |
echo "consul_version: $(consul -v)" | |
- name: Start a Nomad Agent and a Consul agent | |
run: | | |
sudo nomad agent -dev-connect -config nomad/development.hcl &>/dev/null & | |
consul agent -dev -bootstrap &>/dev/null & | |
- name: Wait for initializing... | |
timeout-minutes: 5 | |
run: | | |
RETRY=$((SECONDS+60)) | |
until nomad node status > /dev/null; do | |
if [ $SECONDS -gt $RETRY ]; then | |
echo 'Nomad is not booted after 60 seconds, kill...' | |
if [ -n "$(pidof nomad)" ]; then sudo kill "$(pidof nomad)"; fi | |
sudo nomad agent -dev -config nomad/development.hcl &>/dev/null & | |
RETRY=$((SECONDS+60)) | |
fi | |
sleep 1 | |
done | |
- name: Validate job files | |
run: | | |
shopt -s globstar | |
for job in **/*.nomad; do | |
nomad job validate "$job"; | |
done | |
- name: Run a Nomad job | |
run: | | |
for job in jobs/development/*.nomad; do | |
nomad job run -detach "$job" | |
done | |
- name: Access MediaWiki until success | |
timeout-minutes: 3 | |
run: | | |
echo 'Waiting for http...' | |
until curl -sLfo /dev/null localhost:8080; do | |
sleep 1; done | |
- name: Test VisualEditor API | |
run: | | |
curl -sSLvo /dev/null "http://localhost:8080/api.php?action=visualeditor&page=arbitrary_page&paction=parse&wikitext=arbitrary" | |
curl -sSLvo /dev/null "http://localhost:8080/localhost/v1/" | |
- name: backup of accessing | |
if: ${{ failure() }} | |
run: | | |
echo 'Failed to connect to localhost:8080'; | |
function header { | |
line="--------------------------------------------------------" | |
echo -e "$line\n$1\n$line" | |
} | |
header "journalctl" | |
journalctl -u nomad | |
header "docker images" | |
docker image ls --no-trunc | |
header "nomad status" | |
nomad status | |
for JOB in mysql memcached fastcgi http; do | |
header "nomad job '$JOB' status" | |
nomad job status "$JOB" | |
allocs=$(nomad job status "$JOB" | awk '/Allocations/,0' | tail -n +3 | awk '{if($6=="failed")print $1}') | |
for ALLOC in $allocs; do | |
header "[$JOB] Allocation '$ALLOC' status" | |
nomad alloc status "$ALLOC"; | |
task=$(nomad alloc status -short "$ALLOC" | tail -n1 | awk '{print $1}') | |
header "[$JOB] Allocation '$ALLOC' stdout logs " | |
nomad alloc logs "$ALLOC" $task; | |
header "[$JOB] Allocation '$ALLOC' stderr logs " | |
nomad alloc logs -stderr "$ALLOC" $task; | |
done | |
done | |
curl -sSLv localhost:8080 || true |