Added default server port #321
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: | |
# Sequence of patterns matched against refs/tags | |
branches: | |
- 'dev' | |
- 'v*' | |
create: | |
branches: | |
- 'v*' | |
name: Create discovery engine release after testing the image | |
jobs: | |
build: | |
name: Create discovery engine Release | |
if: github.repository == 'accuknox/discovery-engine' | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout discovery engine code | |
uses: actions/checkout@v2 | |
- name: Setup Enviroment | |
id: vars | |
run: | | |
if [ ${{ github.ref }} == "refs/heads/dev" ]; then | |
echo ::set-output name=tag::latest | |
else | |
echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
fi | |
# setup kubernetes environment | |
./k3s/install_k3s.sh | |
- name: Generate discovery engine artifacts | |
run: | | |
GITHUB_SHA=$GITHUB_SHA ./src/build/build_knoxautopolicy.sh ${{ steps.vars.outputs.tag }} | |
- name: Install Kustomize | |
run: | | |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash | |
sudo mv kustomize /usr/local/bin/ | |
- name: Run discovery engine | |
run: | | |
docker save accuknox/knoxautopolicy:${{ steps.vars.outputs.tag }} | sudo k3s ctr images import - | |
kustomize build ./deployments/k8s/default/discovery-engine | sed -e 's/\(image: *\).*/\1accuknox\/knoxautopolicy:${{ steps.vars.outputs.tag }}/' -e 's/\(imagePullPolicy: *\).*/\1Never/' | kubectl apply -f - | |
kubectl wait --for=condition=ready --timeout=5m -n accuknox-agents pod -l app=discovery-engine | |
kubectl get pods -A | |
#TODO: add the following tests after they are fixed | |
# - name: Test discovery engine | |
# run: | | |
# ./tests/test-scenarios-local.sh ${{ steps.vars.outputs.tag }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_AUTHTOK }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64/v8 | |
- name: Push discovery engine images to Docker | |
run: | | |
GITHUB_SHA=$GITHUB_SHA ./src/build/push_knoxautopolicy.sh ${{ steps.vars.outputs.tag }} | |
push-stable-version: | |
name: Create discovery engine Release - 20.04 | |
needs: build | |
if: github.ref != 'refs/heads/dev' | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout discovery engine code | |
uses: actions/checkout@v2 | |
with: | |
ref: dev | |
- name: Pull Docker Hub image | |
id: match | |
run: | | |
value=`cat STABLE-RELEASE` | |
if [ ${{ github.ref }} == refs/heads/$value ]; then | |
docker pull docker.io/accuknox/knoxautopolicy:$value | |
docker image tag accuknox/knoxautopolicy:$value accuknox/knoxautopolicy:stable | |
echo ::set-output name=tag::true | |
else | |
echo ::set-output name=tag::false | |
fi | |
- name: Login to Docker Hub | |
if: steps.match.outputs.tag == 'true' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_AUTHTOK }} | |
- name: Push discovery engine images to Docker | |
if: steps.match.outputs.tag == 'true' | |
run: GITHUB_SHA=$GITHUB_SHA STABLE_VERSION=$(cat STABLE-RELEASE) ./src/build/push_knoxautopolicy.sh stable | |