rename #617
Workflow file for this run
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
name: Test tekst-workflows | ||
on: | ||
push | ||
jobs: | ||
build_maven_pipeline: | ||
uses: NationalLibraryOfNorway/tekst-workflows/.github/workflows/build-maven-pipeline.yml@main | ||
Check failure on line 7 in .github/workflows/ci_pipeline.yml GitHub Actions / Test tekst-workflowsInvalid workflow file
|
||
with: | ||
ENVIRONMENT: stage | ||
JDK_VERSION: 17 | ||
MAVEN_VERSION: 3.9.6 | ||
USE_MAVEN_PROXY_SETTINGS: true | ||
secrets: | ||
VAULT_URL: ${{ secrets.VAULT_URL }} | ||
VAULT_SECRET_PATH: kv/team/text/data | ||
VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} | ||
VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} | ||
#name: CI/CD Pipeline | ||
# | ||
#on: | ||
# push: | ||
# branches: | ||
# - "**" | ||
# tags: | ||
# - "v*.*.*" | ||
# pull_request: | ||
# branches: | ||
# - "main" | ||
# | ||
#env: | ||
# MAVEN_INFO: "--batch-mode -Dmaven.repo.local=.m2/repository -Dbuild.tag=$GITHUB_REF_NAME -Dbuild.commit-id-short=$GITHUB_SHA -Dbuild.commit-id-long=$GITHUB_SHA -Dbuild.pipeline-id=$GITHUB_RUN_ID" | ||
# | ||
#jobs: | ||
# build-and-test: | ||
# name: Build and Test | ||
# runs-on: [self-hosted-linux] | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# | ||
# - name: Set up JDK 17 | ||
# uses: actions/setup-java@v4 | ||
# with: | ||
# java-version: '17' | ||
# distribution: 'temurin' | ||
# | ||
# - name: Cache Maven packages | ||
# uses: actions/cache@v4 | ||
# with: | ||
# path: ~/.m2 | ||
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
# restore-keys: ${{ runner.os }}-m2 | ||
# | ||
# - name: Install Maven | ||
# run: | | ||
# sudo apt-get update -y | ||
# sudo apt-get install wget -y | ||
# wget https://downloads.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz | ||
# tar xzf apache-maven-3.9.6-bin.tar.gz | ||
# sudo mv apache-maven-3.9.6 /opt/ | ||
# sudo ln -s /opt/apache-maven-3.9.6/bin/mvn /usr/local/bin/mvn | ||
# echo "PATH=/opt/apache-maven-3.9.6/bin:$PATH" >> $GITHUB_ENV | ||
# mvn -v | ||
# | ||
# - name: Build and Test | ||
# run: | | ||
# sed -i "s/https_proxy_host/${{ secrets.HTTP_PROXY }}/g" .m2/settings.xml | ||
# sed -i "s/https_proxy_port/${{ secrets.HTTP_PROXY_PORT }}/g" .m2/settings.xml | ||
# sed -i "s/http_proxy_host/${{ secrets.HTTP_PROXY }}/g" .m2/settings.xml | ||
# sed -i "s/http_proxy_port/${{ secrets.HTTP_PROXY_PORT }}/g" .m2/settings.xml | ||
# mvn -e -s .m2/settings.xml ${{ env.MAVEN_INFO }} verify | ||
# | ||
# - name: Upload artifact | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: bikube.jar | ||
# path: target/bikube.jar | ||
# | ||
# - name: Cache .m2/repository | ||
Check failure on line 109 in .github/workflows/ci_pipeline.yml GitHub Actions / Test tekst-workflowsInvalid workflow file
|
||
# uses: actions/cache@v4 | ||
# with: | ||
# path: ~/.m2/repository | ||
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
# restore-keys: ${{ runner.os }}-m2 | ||
# | ||
# build-and-publish-docker-image: | ||
# needs: build-and-test | ||
# if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | ||
# name: Create and push Docker image | ||
# outputs: | ||
# image_version: ${{ steps.meta.outputs.version }} | ||
# runs-on: [self-hosted-linux] | ||
# steps: | ||
# - name: Check out the repo | ||
# uses: actions/checkout@v4 | ||
# | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v3 | ||
# with: | ||
# driver: docker | ||
# | ||
# - name: Log in to Harbor | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# registry: ${{ secrets.HARBOR_URL }} | ||
# username: ${{ secrets.HARBOR_USERNAME }} | ||
# password: ${{ secrets.HARBOR_PASSWORD }} | ||
# | ||
# - name: Extract metadata (tags, labels) for Docker | ||
# id: meta | ||
# uses: docker/metadata-action@v5 | ||
# with: | ||
# images: harbor.nb.no/tekst/bikube | ||
# tags: | | ||
# type=semver,pattern={{version}} | ||
# type=ref,event=branch | ||
# type=ref,event=pr | ||
# | ||
# - name: Download artifact | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: bikube.jar | ||
# | ||
# - name: Build image | ||
# uses: docker/build-push-action@v5 | ||
# with: | ||
# push: true | ||
# context: . | ||
# tags: ${{ steps.meta.outputs.tags }} | ||
# labels: ${{ steps.meta.outputs.labels }} | ||
# | ||
# deploy-to-k8s-stage: | ||
# name: Deploy to kubernetes stage environment | ||
# needs: build-and-publish-docker-image | ||
# if: github.ref == 'refs/heads/main' | ||
# runs-on: [self-hosted-linux] | ||
# environment: stage | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# | ||
# - name: Import secrets | ||
# id: import-secrets | ||
# uses: hashicorp/vault-action@v3 | ||
# with: | ||
# url: ${{ secrets.VAULT_URL }} | ||
# method: approle | ||
# roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
# secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
# secrets: | | ||
# kv/team/text/data/k8s-text-stage * | ||
# | ||
# - name: Setup Kubectl | ||
# uses: azure/setup-kubectl@v4 | ||
# with: | ||
# version: 'v1.26.5' | ||
# | ||
# - name: Deploy to stage cluster | ||
# run: | | ||
# echo "Deploying to stage version ${{ needs.build-and-publish-docker-image.outputs.image_version }}" | ||
# sed -i "s/<version>/${{ needs.build-and-publish-docker-image.outputs.image_version }}/g" k8s/stage/bikube.yml | ||
# sed -i "s/<host_url>/${{ steps.import-secrets.outputs.K8S_HOST_URL }}/g" k8s/stage/bikube.yml | ||
# kubectl config set-cluster stagecl --server=${{ steps.import-secrets.outputs.K8S_STAGE_SERVER }} | ||
# kubectl config set clusters.stagecl.certificate-authority-data ${{ steps.import-secrets.outputs.K8S_STAGE_NB_NO_CA }} | ||
# kubectl config set-credentials ${{ steps.import-secrets.outputs.K8S_STAGE_USER }} --token=${{ steps.import-secrets.outputs.K8S_STAGE_NB_NO_TOKEN }} | ||
# kubectl config set-context tekst --cluster=stagecl --user=${{ steps.import-secrets.outputs.K8S_STAGE_USER }} --namespace=tekst-stage | ||
# kubectl config use-context tekst | ||
# kubectl config view | ||
# kubectl version | ||
# kubectl apply -f k8s/stage/bikube.yml | ||
# kubectl rollout restart deploy/bikube | ||
# | ||
# deploy-to-k8s-prod: | ||
# name: Deploy to kubernetes prod environment | ||
# needs: build-and-publish-docker-image | ||
# if: startsWith(github.event.ref, 'refs/tags/v') | ||
# runs-on: [self-hosted-linux] | ||
# environment: prod | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v4 | ||
# | ||
# - name: Import secrets | ||
# id: import-secrets | ||
# uses: hashicorp/vault-action@v3 | ||
# with: | ||
# url: ${{ secrets.VAULT_URL }} | ||
# method: approle | ||
# roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
# secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
# secrets: | | ||
# kv/team/text/data/k8s-text-prod * | ||
# | ||
# - name: Setup Kubectl | ||
# uses: azure/setup-kubectl@v4 | ||
# with: | ||
# version: 'v1.26.5' | ||
# | ||
# - name: Deploy to prod cluster | ||
# run: | | ||
# echo "Deploying to production version ${{ needs.build-and-publish-docker-image.outputs.image_version }}" | ||
# sed -i "s/<version>/${{ needs.build-and-publish-docker-image.outputs.image_version }}/g" k8s/prod/bikube.yml | ||
# sed -i "s/<host_url>/${{ steps.import-secrets.outputs.K8S_HOST_URL }}/g" k8s/prod/bikube.yml | ||
# sed -i "s/<alt_host_url>/${{ steps.import-secrets.outputs.ALT_HOST_URL }}/g" k8s/prod/bikube.yml | ||
# kubectl config set-cluster prodcl --server=${{ steps.import-secrets.outputs.K8S_PROD_SERVER }} | ||
# kubectl config set clusters.prodcl.certificate-authority-data ${{ steps.import-secrets.outputs.K8S_PROD_NB_NO_CA }} | ||
# kubectl config set-credentials ${{ steps.import-secrets.outputs.K8S_PROD_USER }} --token=${{ steps.import-secrets.outputs.K8S_PROD_NB_NO_TOKEN }} | ||
# kubectl config set-context tekst --cluster=prodcl --user=${{ steps.import-secrets.outputs.K8S_PROD_USER }} --namespace=tekst-prod | ||
# kubectl config use-context tekst | ||
# kubectl config view | ||
# kubectl version | ||
# kubectl apply -f k8s/prod/bikube.yml | ||
# kubectl rollout restart deploy/bikube |