Skip to content

Create auzre login action #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}
RUN su vscode -c "umask 0002 && dotnet tool install -g Microsoft.Tye --version \"0.10.0-alpha.21420.1\" 2>&1"

# [Choice] Go version
ARG GO_VERSION="1.17"
ARG GO_VERSION="1.18"
RUN if [ "${GO_VERSION}" != "none" ]; then wget https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -P /tmp && sudo tar -xzf /tmp/go${GO_VERSION}.linux-amd64.tar.gz -C /usr/local/ 2>&1 && echo "export PATH=/usr/local/go/bin:${PATH}" | sudo tee /etc/profile.d/go.sh; fi
RUN GOBIN=/tmp/ /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@master && mv /tmp/dlv $GOPATH/bin/dlv-dap

Expand Down Expand Up @@ -33,7 +33,16 @@ ARG USERNAME=vscode
# Install needed packages and setup non-root user. Use a separate RUN statement to add your
# own dependencies. A user of "automatic" attempts to reuse an user ID if one already exists.
COPY library-scripts/docker-in-docker-debian.sh /tmp/library-scripts/
RUN apt-get update \
# Update Yarn GPG key
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/yarn-archive-keyring.gpg --batch
# RUN sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
RUN if [ -f /usr/share/keyrings/yarn-keyring.gpg ]; then sudo rm /usr/share/keyrings/yarn-keyring.gpg; fi
RUN export YARNKEY=yarn-keyring.gpg \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo gpg --dearmour -o /usr/share/keyrings/$YARNKEY --batch \
&& echo "deb [signed-by=/usr/share/keyrings/$YARNKEY] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update \
&& apt-get install python3-pip -y \
# Use Docker script from script library to set things up
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "${USERNAME}" "${USE_MOBY}" "${DOCKER_VERSION}"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
environment: 'AzureChinaCloud'

- name: Deploy bicep
uses: azure/CLI@v1
with:
inlineScript: |
az group create -g ${{ secrets.RESOURCE_GROUP }} -l canadacentral
az group create -g ${{ secrets.RESOURCE_GROUP }} -l chinanorth3
az deployment group create -g ${{ secrets.RESOURCE_GROUP }} -f ./deploy/main.bicep \
-p \
minReplicas=0 \
Expand All @@ -116,4 +117,4 @@ jobs:
containerRegistry=${{ env.REGISTRY }} \
containerRegistryUsername=${{ github.actor }} \
containerRegistryPassword=${{ secrets.GITHUB_TOKEN }} \
deployApim=false
deployApim=true
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on: [push]

name: Run Azure Login With a Service Principal Secret

jobs:

build-and-deploy:
runs-on: ubuntu-latest
steps:

- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
environment: 'AzureChinaCloud'

- name: Azure CLI script
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az account show

5 changes: 3 additions & 2 deletions deploy/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var goServiceAppName = 'go-app'

param apimName string = 'store-api-mgmt-${uniqueString(resourceGroup().id)}'
param deployApim bool = true
param isPrivateRegistry bool = true
param isPrivateRegistry bool = false

param containerRegistry string
param containerRegistryUsername string = 'testUser'
Expand Down Expand Up @@ -54,6 +54,7 @@ module apim 'api-management.bicep' = if (deployApim) {
publisherName: 'Contoso Store'
publisherEmail: '[email protected]'
apimLocation: location
sku: 'Standard'
}
}

Expand Down Expand Up @@ -87,7 +88,7 @@ module pythonService 'container-http.bicep' = {
}
}

resource stateDaprComponent 'Microsoft.App/managedEnvironments/daprComponents@2022-01-01-preview' = {
resource stateDaprComponent 'Microsoft.App/managedEnvironments/daprComponents@2023-04-01-preview' = {
name: '${environmentName}/orders'
dependsOn: [
environment
Expand Down
2 changes: 1 addition & 1 deletion node-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.