Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 85b41eb

Browse files
authored
Setup releases (#305)
Setup infrastructure for GitHub releases and adjust documentation and wording
1 parent d7b9a4e commit 85b41eb

File tree

19 files changed

+182
-66
lines changed

19 files changed

+182
-66
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Push Docker Image (DEV)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}-dev
9+
DEV_BRANCH: dev
10+
11+
jobs:
12+
build_and_push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
ref: ${{ env.DEV_BRANCH }}
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
#with:
28+
# buildkitd-flags: --debug
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v2
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@v4
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
43+
- name: Build Docker image
44+
uses: docker/build-push-action@v3.2.0
45+
with:
46+
context: .
47+
platforms: linux/amd64,linux/arm64
48+
file: ./config/Dockerfile
49+
build-args: |
50+
BTPSA_VERSION_GIT_ARG=${{ github.sha }}
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/docker-build-and-push.yml renamed to .github/workflows/docker-release-build-and-push.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Build and Push Docker Image
1+
name: Build and Push Docker Image (RELEASE)
22

33
on:
44
release:
55
types: [published]
6-
workflow_dispatch:
76

87
env:
98
REGISTRY: ghcr.io
@@ -17,14 +16,16 @@ jobs:
1716
packages: write
1817
steps:
1918
- uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.event.release.commitish }}
2021

2122
- name: Set up QEMU
2223
uses: docker/setup-qemu-action@v2
2324

2425
- name: Set up Docker Buildx
2526
uses: docker/setup-buildx-action@v2
26-
with:
27-
buildkitd-flags: --debug
27+
#with:
28+
# buildkitd-flags: --debug
2829

2930
- name: Log in to the Container registry
3031
uses: docker/login-action@v2

.github/workflows/integration-test-full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
integration-test:
1212
runs-on: ubuntu-latest
1313
container:
14-
image: ghcr.io/sap-samples/btp-setup-automator:main
14+
image: ghcr.io/sap-samples/btp-setup-automator:latest
1515
options: --user root
1616
env:
1717
BTPSA_PARAM_MYEMAIL: ${{ secrets.BTPSA_PARAM_MYEMAIL }}

.github/workflows/integration-test-slim.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
integration-test:
1212
runs-on: ubuntu-latest
1313
container:
14-
image: ghcr.io/sap-samples/btp-setup-automator:main
14+
image: ghcr.io/sap-samples/btp-setup-automator:latest
1515
options: --user root
1616
env:
1717
BTPSA_PARAM_MYEMAIL: ${{ secrets.BTPSA_PARAM_MYEMAIL }}

.github/workflows/update-metadata-artifacts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
types: [btp-metadata-update]
1010

1111
env:
12-
TARGET_BRANCH: main
12+
TARGET_BRANCH: dev
1313
METADATA_SOURCE_OWNER: SAP-samples
1414
METADATA_SOURCE_REPO: btp-service-metadata
1515
METADATA_VERSION: v0
@@ -112,4 +112,4 @@ jobs:
112112
git config user.email "btpsabot@users.noreply.github.com"
113113
git config user.name "[btpsa bot] docu generation"
114114
git diff --quiet && git diff --staged --quiet || git commit -m "[btpsa bot] Generate parameter documentation"
115-
git push
115+
git push origin ${{ env.TARGET_BRANCH }}

README.md

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,28 @@ In case you are new to the containers topic, we **strongly recommended** that yo
4545

4646
## Download and Run
4747

48-
Once the pre-requisites above are all met, you can either use the pre-built Docker image for the `btp-setup-automator`, or build it yourself.
48+
Once the pre-requisites above are all met, you can either use one of the pre-built Docker images for the `btp-setup-automator`, or build it yourself.
4949

5050
### Option 1: Start Docker Container via Pre-Built Image (recommended)
5151

52-
This is the fastest way to use the `btp-setup-automator`. Open a terminal window on your machine and run the following command to pull the Docker image from the GitHub repository and start a container based upon it:
52+
This is the fastest way to use the `btp-setup-automator`. We offer two images for the `btp-setup-automator`:
5353

54-
```bash
55-
docker container run --rm -it --name "btp-setup-automator" "ghcr.io/sap-samples/btp-setup-automator:main"
56-
```
54+
- The **release** image: This is a stable version of the `btp-setup-automator` and corresponds to the latest release visible on the [release section](https://github.com/SAP-samples/btp-setup-automator/releases) of the repository. The corresponding code is taken from the [`main branch`](https://github.com/SAP-samples/btp-setup-automator/tree/main) of the repository.
55+
- The **dev** image: This is an up-to-date version of the `btp-setup-automator`. It usually contains newer features and fixes but was not yet officially released. The corresponding code is taken from the [`dev branch`](https://github.com/SAP-samples/btp-setup-automator/tree/dev) of the repository.
56+
57+
Open a terminal window on your machine and run the following command to pull the Docker image from the GitHub repository and start a container based upon it.
58+
59+
- For the **release** image:
60+
61+
```bash
62+
docker container run --rm -it --name "btp-setup-automator" "ghcr.io/sap-samples/btp-setup-automator:latest"
63+
```
64+
65+
- For the **dev** image:
66+
67+
```bash
68+
docker container run --rm -it --name "btp-setup-automator" "ghcr.io/sap-samples/btp-setup-automator-dev:dev"
69+
```
5770

5871
Here's a brief explanation of the options used:
5972
@@ -77,31 +90,53 @@ You can now run the main script `btpsa` with the following command and you'll be
7790
7891
The tool starts to execute and the only thing you need to type in is your password for your SAP BTP account.
7992
80-
> 📝 Tip - If you are already using VS Code, you should execute this command instead, so that the container runs "detached" (`-d`) from your command line session:
93+
> 📝 Tip - If you are already using VS Code, you should execute this command instead, so that the container runs "detached" (`-d`) from your command line session. Here teh command when using the release image
8194
>
8295
> ```bash
83-
> docker container run --rm -it -d --name "btp-setup-automator" "ghcr.io/sap-samples/btp-setup-automator:main"
96+
> docker container run --rm -it -d --name "btp-setup-automator" "ghcr.io/sap-samples/btp-setup-automator:latest"
8497
> ```
8598
8699
You can also use the provided `run` files to pull the image from the registry and start the container via one command. To do so execute the following command (clone this repo to make the commands available to you):
87100
88101
- bash (macOS/Linux)
102+
- **release** image:
103+
104+
```bash
105+
./run RunReleaseFromRegistry
106+
```
107+
108+
- **dev** image:
89109
90-
```bash
91-
./run RunFromRegistry
92-
```
110+
```bash
111+
./run RunDevFromRegistry
112+
```
93113
94114
- Command Prompt (Windows):
95115
96-
```cmd
97-
.\run.bat RunFromRegistry
98-
```
116+
- **release** image:
117+
118+
```cmd
119+
.\run.bat RunReleaseFromRegistry
120+
```
121+
122+
- **dev** image:
123+
124+
```cmd
125+
.\run.bat RunDevFromRegistry
126+
```
99127
100128
- PowerShell Core (Cross Platform):
129+
- **release** image:
130+
131+
```powershell
132+
.\run.ps1 -RunReleaseFromRegistry $True
133+
```
101134
102-
```powershell
103-
.\run.ps1 -RunFromRegistry $True
104-
```
135+
- **dev** image:
136+
137+
```powershell
138+
.\run.ps1 -RunDevFromRegistry $True
139+
```
105140
106141
### Option 2: Start Docker Container With Self-Built Image
107142
@@ -208,6 +243,8 @@ Checkout [the issues section in this repo](https://github.com/SAP-samples/btp-se
208243
209244
Checkout the [CONTRIBUTING.md file](CONTRIBUTING.md) for more details on how to contribute to this open source project.
210245
246+
> 📝 Tip - If you provide a pull request make sure that the basis of your work as well as the target for your pull request is the `dev` branch of this repository.
247+
211248
## Code of conduct
212249
213250
Checkout the [CODE_OF_CONDUCT.md file](CODE_OF_CONDUCT.md) for more details on the code of conduct for this open source project.

run

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,28 @@ docker container rm -f "${thisname}"
1111
docker image rm -f "${thisname}"
1212

1313

14-
if [ "$1" != "RunFromRegistry" ]; then
14+
if [ "$1" == "RunReleaseFromRegistry" ]; then
1515

16-
echo -e "${GREEN}Building the container image ...${NOCOLOR}"
17-
docker image build -t ${thisname}:latest -f "config/Dockerfile" .
16+
echo -e "${GREEN}Pulling container image RELEASE from registry ...${NOCOLOR}"
17+
docker pull ghcr.io/sap-samples/btp-setup-automator:latest
1818

1919
echo -e "${GREEN}Starting the container as '${thisname}' - Access possible e.g. via VS Code${NOCOLOR}"
20-
docker container run -e BTPSA_VERSION_GIT="$(git describe --long --tags --always)" --rm -it -d --name "${thisname}" "${thisname}"
20+
docker container run --rm -it -d --name "${thisname}" ghcr.io/sap-samples/btp-setup-automator:latest
21+
22+
elif [ "$1" == "RunDevFromRegistry" ]; then
23+
24+
echo -e "${GREEN}Pulling container image DEV from registry ...${NOCOLOR}"
25+
docker pull ghcr.io/sap-samples/btp-setup-automator-dev:dev
26+
27+
echo -e "${GREEN}Starting the container as '${thisname}' - Access possible e.g. via VS Code${NOCOLOR}"
28+
docker container run --rm -it -d --name "${thisname}" ghcr.io/sap-samples/btp-setup-automator-dev:dev
2129

2230
else
2331

24-
echo -e "${GREEN}Pulling container image from registry ...${NOCOLOR}"
25-
docker pull ghcr.io/sap-samples/btp-setup-automator:main
32+
echo -e "${GREEN}Building the container image ...${NOCOLOR}"
33+
docker image build -t ${thisname}:latest -f "config/Dockerfile" .
2634

2735
echo -e "${GREEN}Starting the container as '${thisname}' - Access possible e.g. via VS Code${NOCOLOR}"
28-
docker container run --rm -it -d --name "${thisname}" ghcr.io/sap-samples/btp-setup-automator:main
36+
docker container run -e BTPSA_VERSION_GIT="$(git describe --long --tags --always)" --rm -it -d --name "${thisname}" "${thisname}"
2937

3038
fi

run.bat

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,34 @@ docker container rm -f "btp-setup-automator"
88
docker image rm -f "btp-setup-automator"
99

1010

11-
if not "%1" == "RunFromRegistry" (
12-
13-
echo %ESC%[32mBuilding the container image ...%ESC%[0m
14-
docker image build -t btp-setup-automator:latest -f .\config\Dockerfile .
15-
16-
echo %ESC%[32mStarting the container as 'btp-setup-automator' - Access possible e.g. via VS Code%ESC%[0m
17-
docker container run -e BTPSA_VERSION_GIT="$(git describe --long --tags --always)" --rm -it -d --name btp-setup-automator btp-setup-automator
18-
19-
) else (
20-
21-
echo %ESC%[32mPulling container image from registry ...%ESC%[0m
22-
docker pull ghcr.io/sap-samples/btp-setup-automator:main
23-
24-
echo %ESC%[32mStarting the container as 'btp-setup-automator' - Access possible e.g. via VS Code%ESC%[0m
25-
docker container run --rm -it -d --name btp-setup-automator ghcr.io/sap-samples/btp-setup-automator:main
26-
27-
)
11+
if "%1" == "RunReleaseFromRegistry" goto release
12+
if "%1" == "RunDevFromRegistry" goto dev
13+
14+
echo %ESC%[32mBuilding the container image ...%ESC%[0m
15+
docker image build -t btp-setup-automator:latest -f .\config\Dockerfile .
16+
echo %ESC%[32mStarting the container as 'btp-setup-automator' - Access possible e.g. via VS Code%ESC%[0m
17+
docker container run -e BTPSA_VERSION_GIT="$(git describe --long --tags --always)" --rm -it -d --name btp-setup-automator btp-setup-automator
18+
goto end
19+
20+
:release
21+
echo %ESC%[32mPulling container image RELEASE from registry ...%ESC%[0m
22+
docker pull ghcr.io/sap-samples/btp-setup-automator:latest
23+
echo %ESC%[32mStarting the container as 'btp-setup-automator' - Access possible e.g. via VS Code%ESC%[0m
24+
docker container run --rm -it -d --name btp-setup-automator ghcr.io/sap-samples/btp-setup-automator:latest
25+
goto end
26+
27+
:dev
28+
echo %ESC%[32mPulling container image DEV from registry ...%ESC%[0m
29+
docker pull ghcr.io/sap-samples/btp-setup-automator-dev:dev
30+
echo %ESC%[32mStarting the container as 'btp-setup-automator' - Access possible e.g. via VS Code%ESC%[0m
31+
docker container run --rm -it -d --name btp-setup-automator ghcr.io/sap-samples/btp-setup-automator-dev:dev
32+
goto end
2833

2934
:setESC
3035
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
3136
set ESC=%%b
3237
exit /B 0
3338
)
39+
40+
:end
3441
exit /B 0

run.ps1

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
#!/usr/bin/pwsh
22
Param(
33
[Parameter(Mandatory=$False)]
4-
[bool]$RunFromRegistry = $False
4+
[bool]$RunReleaseFromRegistry = $False,
5+
[bool]$RunDevFromRegistry = $False
56
)
67

78
Write-Host "Cleaning up containers and images (if existing)" -ForegroundColor green
89
docker container stop "btp-setup-automator"
910
docker container rm -f "btp-setup-automator"
1011
docker image rm -f "btp-setup-automator"
1112

12-
if ( $RunFromRegistry -eq $False )
13+
if ( $RunReleaseFromRegistry -eq $True )
1314
{
14-
Write-Host "Building the container image ..." -ForegroundColor green
15-
docker image build -t btp-setup-automator:latest -f "config/Dockerfile" .
15+
Write-Host "Pulling container image RELEASE from registry ..." -ForegroundColor green
16+
docker pull ghcr.io/sap-samples/btp-setup-automator:latest
1617

1718
Write-Host "Starting the container as 'btp-setup-automator' - Access possible e.g. via VS Code" -ForegroundColor green
18-
docker container run -e BTPSA_VERSION_GIT="$(git describe --long --tags --always)" --rm -it -d --name "btp-setup-automator" "btp-setup-automator"
19+
docker container run --rm -it -d --name "btp-setup-automator" ghcr.io/sap-samples/btp-setup-automator:latest
20+
}
21+
22+
elseif ($RunDevFromRegistry -eq $True) {
23+
Write-Host "Pulling container image DEV from registry ..." -ForegroundColor green
24+
docker pull ghcr.io/sap-samples/btp-setup-automator-dev:dev
25+
26+
Write-Host "Starting the container as 'btp-setup-automator' - Access possible e.g. via VS Code" -ForegroundColor green
27+
docker container run --rm -it -d --name "btp-setup-automator" ghcr.io/sap-samples/btp-setup-automator-dev:dev
1928
}
29+
2030
else
2131
{
22-
Write-Host "Pulling container image from registry ..." -ForegroundColor green
23-
docker pull ghcr.io/sap-samples/btp-setup-automator:main
32+
Write-Host "Building the container image ..." -ForegroundColor green
33+
docker image build -t btp-setup-automator:latest -f "config/Dockerfile" .
2434

2535
Write-Host "Starting the container as 'btp-setup-automator' - Access possible e.g. via VS Code" -ForegroundColor green
26-
docker container run --rm -it -d --name "btp-setup-automator" ghcr.io/sap-samples/btp-setup-automator:main
36+
docker container run -e BTPSA_VERSION_GIT="$(git describe --long --tags --always)" --rm -it -d --name "btp-setup-automator" "btp-setup-automator"
2737
}

usecases/other/discoverycenter/3774-taskcenter/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Open a command line terminal on your machine.
2020
Enter the following command into the terminal and press the `ENTER` key:
2121

2222
```bash
23-
docker container run --platform linux/amd64 --rm -it --name "btp-setup-automator" "ghcr.io/sap-samples/btp-setup-automator:main"
23+
docker container run --platform linux/amd64 --rm -it --name "btp-setup-automator" "ghcr.io/sap-samples/btp-setup-automator:latest"
2424
```
2525

2626
You'll notice that the prompt in your terminal has changed, because you are now working inside the docker container, that you just started.

0 commit comments

Comments
 (0)