Reputation: 1
My teammate and I are trying to build CI/CD pipelines (separate pipelines), one is to check code, build and publish the maven package to Github, and the other is to deploy the app to Azure (We are using Azure for Student).
You can take a look at our yml files here: CI https://starb.in/g7BhOF.yaml
CD https://starb.in/AUTaNd.yaml
The building job succeeded, but we keep getting different errors when trying to deploy our app to Azure. Especially the "Bad Archive" error.
Initially, we wanted to make the deployment job automatic, but since it did not work, we have decided to make it manual by asking for input of which version to deploy. You can check out the manual version here:
However, this one has another problem which the content of our settings.xml file is not correct.
Please let me know what we should try next, how we could solve this and what the problems of our pipelines are.
Thank you very much.
Upvotes: 0
Views: 66
Reputation: 3649
Unable to deploy a Java Web App to Azure (from Github)
Bad Archive
error occurs because the .jar
file you’re trying to deploy is either corrupted or not found.
I have created a sample Spring Boot application and deployed to the Azure App Service using GitHub actions.
By using the below workflow file, I was successfully deployed my Spring Boot app to Azure App Service.
name: Build and deploy JAR app to Azure Web App - kamspring
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Java version
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'microsoft'
- name: Build with Maven
run: mvn clean install
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: java-app
path: '${{ github.workspace }}/target/*.jar'
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: java-app
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'kamspring'
slot-name: 'Production'
package: '*.jar'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_AA454CB7DFBE4B0F8058DDF589ABEB33 }}
Azure App Service Output :
Upvotes: 0