Skip to content

Build artifacts for deployment testing #7

Build artifacts for deployment testing

Build artifacts for deployment testing #7

name: Build artifacts for deployment testing
on:
workflow_dispatch:
workflow_call:
jobs:
docker-ee:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: gravitl/netmaker
ref: develop
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push test
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: gravitl/netmaker:develop-ee
build-args: tags=ee
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: gravitl/netmaker
ref: develop
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push test
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: gravitl/netmaker:develop
docker-netclient:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: gravitl/netclient
ref: develop
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push test
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: gravitl/netclient:testing, gravitl/netclient:develop
netclient:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: gravitl/netclient
ref: develop
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: build client
run: |
CGO_ENABLED=0 go build -ldflags="-s -w" -mod=mod -o build/netclient
- name: deploy
uses: mdallasanta/[email protected]
with:
local: ./build/netclient # Local file path - REQUIRED false - DEFAULT ./
remote: /var/www/files/testing/ # Remote file path - REQUIRED false - DEFAULT ~/
host: fileserver.clustercat.com # Remote server address - REQUIRED true
# port: ${{secrets.PORT}} # Remote server port - REQUIRED false - DEFAULT 22
user: root # Remote server user - REQUIRED true
# password: ${{secrets.PASSWORD}} # User password - REQUIRED at least one of "password" or "key"
key: ${{secrets.TESTING_SSH_KEY}} # Remote server private key - REQUIRED at least one of "password" or "key"
# pre_upload: echo "This will be executed before the upload!" # Command to run via ssh before scp upload - REQUIRED false
# post_upload: echo "This will be executed after the upload!" # Command to run via ssh after scp upload - REQUIRED false
# ssh_options: -o StrictHostKeyChecking=no # A set of ssh_option separated by -o - REQUIRED false - DEFAULT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
# scp_options: -v # Flags to use during scp - REQUIRED false - DEFAULT ''
test-app:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: gravitl/devops
ref: ${{ github.ref }}
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: build test app
run: |
cd test
CGO_ENABLED=0 go build -ldflags="-s -w" -mod=mod -o ./test
- name: deploy
uses: mdallasanta/[email protected]
with:
local: ./test/test # Local file path - REQUIRED false - DEFAULT ./
remote: /var/www/files/testing/ # Remote file path - REQUIRED false - DEFAULT ~/
host: fileserver.clustercat.com # Remote server address - REQUIRED true
# port: ${{secrets.PORT}} # Remote server port - REQUIRED false - DEFAULT 22
user: root # Remote server user - REQUIRED true
# password: ${{secrets.PASSWORD}} # User password - REQUIRED at least one of "password" or "key"
key: ${{secrets.TESTING_SSH_KEY}} # Remote server private key - REQUIRED at least one of "password" or "key"
# pre_upload: echo "This will be executed before the upload!" # Command to run via ssh before scp upload - REQUIRED false
# post_upload: echo "This will be executed after the upload!" # Command to run via ssh after scp upload - REQUIRED false
# ssh_options: -o StrictHostKeyChecking=no # A set of ssh_option separated by -o - REQUIRED false - DEFAULT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
# scp_options: -v # Flags to use during scp - REQUIRED false - DEFAULT ''
ui-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: gravitl/netmaker-ui-2
ref: develop
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push test
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
file: ./Dockerfile.standalone
push: true
tags: gravitl/netmaker-ui:testing, gravitl/netmaker-ui:develop
build-packages:
needs: netclient
runs-on: ubuntu-latest
steps:
- name: set variables
run: |
PUBLISHED=$(curl https://api.github.com/repos/gravitl/netclient/releases/latest | jq .published_at | tr -d '"')
if [[ $PUBLISHED -eq 'null' ]]; then
RELEASED=1677000000
else
RELEASED=$(date --date=${PUBLISHED} +%s)
fi
NOW=$(date +%s)
DIFF=$((NOW - RELEASED))
REVISION=$((DIFF/84000))
echo "REVISION"=${REVISION} >> $GITHUB_ENV
- name: Setup SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/id_devops
chmod 600 ~/.ssh/id_devops
cat >>~/.ssh/config <<END
Host *.clustercat.com
User root
IdentityFile ~/.ssh/id_devops
StrictHostKeyChecking no
END
env:
SSH_KEY: ${{ secrets.TESTING_SSH_KEY }}
- name: build linux package
run: |
ssh [email protected] "cd packages; git restore .; git pull; export VERSION=0.24.3; export REVISION=${{ env.REVISION }}; ./apt_test_builder.sh; git restore ."