Skip to content

Merge pull request #231 from navikt/feature/fjern-beregning-tester #734

Merge pull request #231 from navikt/feature/fjern-beregning-tester

Merge pull request #231 from navikt/feature/fjern-beregning-tester #734

name: build and deploy
on:
push:
branches:
- '**'
- '!feature/cron-fix'
env:
INGRESS_CUCUMBER: https://bidrag-cucumber-cloud.ekstern.dev.nav.no
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
permissions:
contents: "read"
id-token: "write"
name: Build with maven and docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: mvn -B -e --settings .m2/maven-settings.xml clean install
- uses: nais/docker-build-push@v0
id: docker-push
with:
team: bidrag
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.docker-push.outputs.image }}
tag: ${{ steps.docker-push.outputs.tag }}
deploy-feature:
runs-on: ubuntu-latest
name: Deploy feature
needs: build
steps:
- uses: actions/checkout@v3
with:
path: deploy
- name: Deploy to dev-gcp for feature.yaml
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/.nais/nais.yaml
VARS: deploy/.nais/feature.yaml
IMAGE: ${{ needs.build.outputs.image }}
deploy-main:
runs-on: ubuntu-latest
name: Deploy main
if: github.ref != 'refs/heads/main'
needs: build
steps:
- uses: actions/checkout@v3
with:
path: deploy
- name: Deploy to dev-gcp for feature.yaml
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/.nais/nais.yaml
VARS: deploy/.nais/main.yaml
IMAGE: ${{ needs.build.outputs.image }}
run-tests-for-cucumber-cloud:
runs-on: ubuntu-latest
name: bidrag-cucumber-cloud
needs: [deploy-feature, deploy-main]
steps:
- run: echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
if: github.ref != 'refs/heads/main'
- run: |
curl -i -H "Content-Type: application/json" \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"ingressesForApps":[
"${{ env.INGRESS_CUCUMBER }}@tag:bidrag-cucumber-cloud"
], "skipAuth": true}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-stonad:
runs-on: ubuntu-latest
name: bidrag-stonad
needs: [deploy-feature, deploy-main]
env:
INGRESS_STONAD: https://bidrag-stonad.intern.dev.nav.no
INGRESS_VEDTAK: https://bidrag-vedtak.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_STONAD=https://bidrag-stonad-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_VEDTAK=https://bidrag-vedtak-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@bidrag-stonad-vedtak"],"noContextPathForApps":["bidrag-vedtak"],"ingressesForApps":[
"${{ env.INGRESS_VEDTAK }}@bidrag-vedtak"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-stonad"],"ingressesForApps":[
"${{ env.INGRESS_STONAD }}@tag:bidrag-stonad"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-vedtak:
runs-on: ubuntu-latest
name: bidrag-vedtak
needs: [deploy-feature, deploy-main]
env:
INGRESS_VEDTAK: https://bidrag-vedtak.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_VEDTAK=https://bidrag-vedtak-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-vedtak"],"ingressesForApps":[
"${{ env.INGRESS_VEDTAK }}@tag:bidrag-vedtak"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-grunnlag:
runs-on: ubuntu-latest
name: bidrag-grunnlag
needs: [deploy-feature, deploy-main]
env:
INGRESS_GRUNNLAG: https://bidrag-grunnlag.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_GRUNNLAG=https://bidrag-grunnlag-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-grunnlag"],"ingressesForApps":[
"${{ env.INGRESS_GRUNNLAG }}@tag:bidrag-grunnlag"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-arbeidsflyt:
runs-on: ubuntu-latest
name: bidrag-arbeidsflyt
needs: [deploy-feature, deploy-main]
env:
INGRESS_OPPGAVE: https://oppgave.dev-fss-pub.nais.io
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_OPPGAVE=https://oppgave-q1.dev-fss-pub.nais.io" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- name: endre-fagomrade
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-endre-fagomrade"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- name: journalforing
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-journalforing"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- name: opprett-oppgave
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-opprett-oppgave"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- name: overfor-til-annen-enhet
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-overfor-til-annen-enhet"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-dokument-forsendelse:
runs-on: ubuntu-latest
name: bidrag-dokument-forsendelse
needs: [deploy-feature, deploy-main]
env:
INGRESS_DOKUMENT_FORSENDELSE: https://bidrag-dokument-forsendelse.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_DOKUMENT_FORSENDELSE=https://bidrag-dokument-forsendelse-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-dokument-forsendelse"],"ingressesForApps":[
"${{ env.INGRESS_DOKUMENT_FORSENDELSE }}@tag:bidrag-dokument-forsendelse"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
bump_dev_version:
runs-on: ubuntu-latest
name: Bump SNAPSHOT version
if: github.ref == 'refs/heads/main'
needs:
- run-tests-for-cucumber-cloud
- run-tests-for-arbeidsflyt
- run-tests-for-bidrag-stonad
- run-tests-for-bidrag-vedtak
- run-tests-for-bidrag-grunnlag
- run-tests-for-bidrag-dokument-forsendelse
steps:
- uses: actions/checkout@v2
- uses: navikt/bidrag-git/tag-snap@v1-tag-snap